Skip to content

@class with mapped types can incorrectly handle properties #2842

@Gerrit0

Description

@Gerrit0

Search terms

@class defineComponent

Expected Behavior

declare function defineComponent<
    T extends Record<string, () => any>,
    U extends Record<string, any>,
>(component: {
    computed: T;
    props: U;
}): new () => U & { [K in keyof T]: ReturnType<T[K]> };

/** @class */
export const ComputedClass = defineComponent({
    computed: {
        hello() {
            return "hello";
        },
    },
    props: {
        name: "world",
    },
});

Should produce a class with a hello property which has type string

Actual Behavior

TypeDoc makes a class with a hello property of type any

Environment

  • Typedoc version: 0.27.6
  • TypeScript version: 5.7.2
  • Node.js version: 20
  • OS: Fedora

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions