Skip to content

Specify what's going on when reporting "X not assignable to X" error for identical X #12050

Closed
@RyanCavanaugh

Description

@RyanCavanaugh

From #12005 (comment)

We can sometimes get into a state where we issue errors that appear to be nonsense:

interface T { }
declare const a: T;
class Foo<T> {
    x: T;
    fn() {
        this.x = a;
    }
}

image

When two types have the same spellings according to typeToString, we should issue a more specific error, e.g.

"Type T is not assignable to type T. Two different types with this name exist, but they are unrelated."

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issueHelp WantedYou can do thisSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions