| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| const instantiatedType = instantiateType(contextualType, cloneTypeMapper(getContextualMapper(node))); | ||
| // If the contextual type is a generic pure function type, we instantiate the type with | ||
| // its own type parameters and type arguments. This ensures that the type parameters are | ||
| // not erased to type any during type inference such that they can be inferred as actual |
There was a problem hiding this comment.
type 'any'
Sorry, something went wrong.
| // Inferences made from return types have lower priority than all other inferences. | ||
| inferTypes(context.inferences, instantiatedType, returnType, InferencePriority.ReturnType); | ||
| const instantiatedType = instantiateType(contextualType, cloneTypeMapper(getContextualMapper(node))); | ||
| // If the contextual type is a generic pure function type, we instantiate the type with |
There was a problem hiding this comment.
What is meant by "generic pure function type"?
Sorry, something went wrong.
There was a problem hiding this comment.
A type that has nothing but a single call signature.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
With this PR we do not erase the type parameters of contextual generic function types. Instead, the type parameters are allowed to propagate into the contextually typed expression. For example:
Previously, contextual generic function types were ignored and a would therefore have been of type any.
This PR also expands upon #16072 to permit the contextual type of a generic function to itself be a generic function type. For example:
Fixes #16293.