Skip to content

If call doesn’t resolve to an overload signature, issue a better error when the implementation would work #25488

@DanielRosenwasser

Description

@DanielRosenwasser
interface Foo { hello: string };

function bar1(...foos: Foo[]) {
    bar2(...foos);
}

function bar2(foo1: Foo);
function bar2(foo1: Foo, foo2: Foo);
function bar2(...foos: Foo[]) {
    return;
}

Here we provide an error message like

Expected 1-2 arguments, but got 0 or more.

I just spoke to three engineers who had no indication of what was actually going wrong. We should

  • Inform the user that implementation signatures aren't part of the overload set, and that they should consider making the overload an implementation signature
  • Provide a quick fix to do so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions