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

can error message for overload display more information? #26633

Closed
eLeontev opened this issue Aug 23, 2018 · 3 comments
Closed

can error message for overload display more information? #26633

eLeontev opened this issue Aug 23, 2018 · 3 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@eLeontev
Copy link

In Overloads section in https://www.typescriptlang.org/docs/handbook/functions.html mentioned that overload is supported, but that about notification in case if arguments is wrong?

According doc's example we have next error message: "Argument of type 'passedArgumentType' is not assignable to parameter of type 'expectedArgumentType'"
The message will be more informative if whole list of overloads will be displayed.

image

I would expect next message: "Argument of type '""' is not assignable to parameter of list of types 'number' or '{suit: string; card: number; }[]'"

In this case developer can see all list of available types for overloads what will reduce the search of all supported types.

Please let me know is my proposual correct and can it be implemented?

@RyanCavanaugh RyanCavanaugh added the Working as Intended The behavior described is the intended behavior; this is not a bug label Aug 24, 2018
@RyanCavanaugh
Copy link
Member

There can be potentially dozens of overloads and it'd be unreasonable to explain why all of them failed. See existing issues for requests that we detect which overload you were "trying" to call.

@eLeontev
Copy link
Author

Can you explain why is it unreasonable? Usually count of overloads in not so many (2-3 is common practice). I'm not sure that adding one or two more lines with inforamation about supported types will increase error message text to extra large size.

Separately checked it on Java - all supported overloads are displayed.

@Arlen22
Copy link

Arlen22 commented Feb 11, 2024

Obviously knowing the errors for the first two overloads out of five tells me literally nothing about my problem if I'm aiming for a different overload. Visual Studio with C# I believe does (or did at one time) show you the error for each overload as you scrolled through them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

3 participants