Skip to content

Compiler gives two different errors for wrong number of type arguments #19374

Open
@sandersn

Description

@sandersn
class B<T, U = number> {
    t: T
    u: U
}
class D extends B<string, string, string> {
                ~
                Generic type B<T, U> requires between 1 and 2 type arguments.
    d: number
}
let b = new B<string, string, string>()
        ~~~
        Expected 1-2 type arguments, but got 3.

Expected behavior:
You get a wordier, less helpful message when incorrectly extending a base class. You get a terser, more detailed, message when incorrectly creating an instance of the base class.

Actual behavior:
Both messages should be the new terse, detailed message. I forgot to change this when I added the new message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Error MessagesThe issue relates to error messaging

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions