-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Type inference for generic functions #11537
Comments
Related: #11311 |
might be |
If it's compatibility problem, it would be really helpful to have a "strictTyping" compilation mode which would prohibit converting the |
they say without |
An ugly workaround function getId<T>(): (v: T) => T { return v => v; }
applyToNumber(5, getId()); // error, can't infer the 'T' type.
applyToNumber(5, getId<number>()); // ok but 'v => v' looks better. |
looks like its time to bite that bullet or else you gonna break that all time record of the number of open issues related to the same problemo |
The sample given: applyToNumber("aaa", id); // ok, but an error is expected. in TS 2.6 returns error:
So I assume it's fixed. |
thanks! closing. |
TypeScript Version: 2.0.3
Code
Expected behavior:
error
Actual behavior:
no error.
The text was updated successfully, but these errors were encountered: