-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Callback arguments are inferred as any when function has multiple overloads and callback arguments are typed as tuple #41709
Comments
Overload signatures should go from most specific to least specific. You should change the order of the overloads, then it works. |
No, then signature When you change the order and call |
I'd need a more realistic example to comment on what the expected behavior is here. The first overload is doing nothing; there's no reason that I can see to not just have the 3-tuple one. |
@RyanCavanaugh Check the error on line 117. |
TypeScript Version: 4.0.5 or higher
Search Terms: function overloads, tuples
Code
Expected behavior:
num
,str
andbool
should be type ofnumber
,string
andboolean
.Actual behavior:
num
,str
andbool
are type ofany
Playground Link:
https://www.typescriptlang.org/play?ts=4.0.5&ssl=3&ssc=32&pln=3&pc=35#code/GYVwdgxgLglg9mABMAFBAhgG0wI3RAawC5EUA6C9AJwHMBnEgbTBAFscBTKgGkTqiowwNALoBKRAF4AfIgBucGABMxJBcoDcAKFCRYCZGiy58xUhTLV6TFuy69+g4bxxw4mDujDips9SrVFJW1daHgkVAxsPEISckpaBkQvAE9GHxl5INUs5UQAbwBfLS0AelLEJQ5WOB0UFFsHAQlMorENRHLkGCp+PhgaMHQoECoOEjgCEtQGtiaeRFd3Ftk2jq66DggEJX7B4dHx5Oxk2jYOMCg6RAALdDkOZLAUxCgUgAcOLSA
The text was updated successfully, but these errors were encountered: