Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DanielRosenwasser opened this issue Jul 6, 2018 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@DanielRosenwasser
Copy link
Member

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.
@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Domain: Error Messages The issue relates to error messaging labels Jul 6, 2018
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 3.1 milestone Jul 6, 2018
@sandersn sandersn 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 Jul 9, 2018
@sandersn sandersn 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 Jul 9, 2018
@RyanCavanaugh
Copy link
Member

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

@DanielRosenwasser
Copy link
Member Author

DanielRosenwasser commented Jul 13, 2018

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

@DanielRosenwasser
Copy link
Member Author

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

@DanielRosenwasser DanielRosenwasser added Duplicate An existing issue was already created and removed Bug A bug in TypeScript Domain: Error Messages The issue relates to error messaging labels Feb 21, 2019
@DanielRosenwasser DanielRosenwasser removed this from the TypeScript 3.4.0 milestone Feb 21, 2019
@typescript-bot
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants