Skip to content

Declaration emit is incorrect when type parameter names collide #16313

@DanielRosenwasser

Description

@DanielRosenwasser
function f<T>(p: T) {
    let g: <T>(x: T) => typeof p = null as any;
    return g;
}

Calling f(10) will produce something of type <T>(x: T) => number, however, the declaration emit is the following:

declare function f<T>(p: T): <T>(x: T) => T;

But calling that f produces the type <T>(x: T) => T.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions