-
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
Make functions generic when contextually typed by a generic signature #5737
Comments
Technically this is according to per spec (I know, your favorite response), but I think we should do better here. Section 4.2.3 (https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#423-contextually-typed-expressions) says
We already said that we should contextually type parameters when type annotations are present somewhere --- no reason we shouldn't contextually type using the non-generic parameter positions or non-generic return positions. |
Improved union/intersection type inference Conflicts: src/compiler/checker.ts
@RyanCavanaugh There is no easy way to tell whether a particular type references a type parameter and I honestly think that we either contextually type all parameters or none. Anything in between just gets even more confusing. |
The text was updated successfully, but these errors were encountered: