-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
This type parsing error and incorrect type inference #9744
Comments
This is still going to be an error because it doesn't make sense for an arrow function to specify its |
Regarding the second thing, this is because we don't contextually type parameters when any parameter has a type annotation. There's a bug on that somewhere but I can't find it at the moment; we should revisit it (if it's closed) at the very least for the case where the only annotated parameter is the Edit: #4241 |
Let me add on to this issue (it doesn't seem worth filing another): a let f = <T>(this: number) => { // no error
let that = this; // resolved the same way as if `this: number` were not specified;
// may be an error depending on context and compiler options
}; |
Fix is up at #25863. |
thanks @mattmccutchen! |
TypeScript Version: 2.0.0 (I suppose beta, though tsc -v just reports 2.0.0)
Code
Expected behavior:
1st: no parsing error.
2nd: event: MouseEvent inference, as for
e.onclick = function(event) { };
Actual behavior:
The text was updated successfully, but these errors were encountered: