Skip to content

5.8.2 generates incorrect d.ts for generics in static method #61334

@crimx

Description

@crimx

🔎 Search Terms

"5.8.2", "dts", "d.ts", "static", "generic"

🕗 Version & Regression Information

  • This changed between versions 5.7.3 and 5.8.2

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.8.2#code/KYDwDg9gTgLgBAQwEYGcZQQY3pgNglFOAQQB4AVOAXkQDsBPAGjgFVq76A+OAbwCg4guGACuSXAEtMcNAhhS4UYAgAmEWrnpwA6lHUBzdhWZsaCBpwAUANwS4RwAFxxyASmdlyJ7lW78hAYrAMCJQtHC0Iri4iETm9AJCAL58SUA

💻 Code

export abstract class A<T = any, U = any> {
    public static readonly Fn = <T, U = any>(value: T): A<T, U> => {
        return null as any
    }
}

🙁 Actual behavior

Outputs d.ts(5.8.2):

export declare abstract class A<T = any, U = any> {
    static readonly Fn: <T, U = any>(value: T_1) => A<T_1, U_1>;
}

🙂 Expected behavior

Outputs d.ts(5.7.3):

export declare abstract class A<T = any, U = any> {
    static readonly Fn: <T_1, U_1 = any>(value: T_1) => A<T_1, U_1>;
}

Additional information about the issue

No response

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions