Skip to content

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

Closed

Description

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.

Activity

  1. changed the title [-]Check if implementation signature is valid when overloads aren't[/-] [+]If call doesn’t resolve to an overload signature, issue a better error when the implementation would resolve[/+] on Jul 9, 2018
  2. changed the title [-]If call doesn’t resolve to an overload signature, issue a better error when the implementation would resolve[/-] [+]If call doesn’t resolve to an overload signature, issue a better error when the implementation would work[/+] on Jul 9, 2018
  3. RyanCavanaugh commented on Jul 9, 2018

    @RyanCavanaugh
    Member

    I'm worried this will be misleading in a lot of cases

  4. DanielRosenwasser commented on Jul 13, 2018

    @DanielRosenwasser
    MemberAuthor

    I agree, but we should run it on user tests and the RWC and see what it looks like.

  5. DanielRosenwasser commented on Feb 21, 2019

    @DanielRosenwasser
    MemberAuthor

    Turns out this is a duplicate of #4797. Two Dans can't be wrong.

  6. typescript-bot commented on Feb 24, 2019

    @typescript-bot
    Contributor

    This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

  7. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions