Skip to content

Incorrect code generated by "add extends constraint" fix for multiple usages of the same type parameter #49964

Closed
@DanielRosenwasser

Description

@DanielRosenwasser
// @strict: true
interface TypeRef<T extends {}> {
    x: T,
}

function foo<T>(): TypeRef</**/T> {
    throw undefined as any as TypeRef<T>;
}

Run Add `extends` constraint to all type parameters.

Expected

interface TypeRef<T extends {}> {
    x: T,
}

function foo<T extends {}>(): TypeRef<T> {
    throw undefined as any as TypeRef<T>;
}

Actual

interface TypeRef<T extends {}> {
    x: T,
}

function foo<T extends {} extends {}>(): TypeRef<T> {
    throw undefined as any as TypeRef<T>;
}

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Quick FixesEditor-provided fixes, often called code actions.Effort: CasualGood issue if you're already used to contributing to the codebase. Harder than "good first issue".Fix AvailableA PR has been opened for this issueHelp WantedYou can do this

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions