-
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
Add inference priority for mapped type keys #22246
Conversation
381012e
to
f48dfb0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from my spelling nit, this looks good. Just tackle this.
src/compiler/types.ts
Outdated
AlwaysStrict = 1 << 4, // Always use strict rules for contravariant inferences | ||
NakedTypeVariable = 1 << 0, // Naked type variable in union or intersection type | ||
HomomorphicMappedType = 1 << 1, // Reverse inference for hoimomorphic mapped type | ||
MappedType = 1 << 2, // Reverse inference for mapped type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MappedTypeConstraint
@DanielRosenwasser done. Build break is fixed by #22247 |
The new priority causes union inference, similarly to return type
8046705
to
9e12919
Compare
src/compiler/types.ts
Outdated
NoConstraints = 1 << 3, // Don't infer from constraints of instantiable types | ||
AlwaysStrict = 1 << 4, // Always use strict rules for contravariant inferences | ||
NakedTypeVariable = 1 << 0, // Naked type variable in union or intersection type | ||
HomomorphicMappedType = 1 << 1, // Reverse inference for hoimomorphic mapped type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: homomorphic.
Also I think it would be more accurate to say "inference made to a reverse" instead of "reverse inference for" on this line and the next.
The new priority causes union inference, similar to the return type inference priority.
Fixes #22242