-
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
Wrong type inferred for indirect call of generic function #29638
Comments
We don't do full unification - we match parameters from left to right (which is why reversing the order fixes the issue). It's a known design limitation - we've talked about improving it before (you can probably find related discussions by searching for topics about higher order functions). |
Would this also be fixed by #30215? Edit: Ah, I guess not, because that PR states:
Indeed this won't be supported yet with that change: #30215 (comment) |
@RyanCavanaugh Why did you close this if the reported issue still persists? |
Actually, this issue is fixed with the latest commits in #30215. |
TypeScript Version: 3.2.2
Search Terms: Generics, lookahead, type inference
Code
Expected behavior:
x
is of typenumber
Actual behavior:
x
is of type{}
only
y
is of type numberPlayground Link: Playground link
Related Issues: I didn't find anything related, but maybe I have been using the wrong search term ("lookahead").
The text was updated successfully, but these errors were encountered: