Skip to content

Commit 664c4d9

Browse files
committed
Changes to allow propagating type parameters with no inferences.
A summary of the bigger pieces I can think of: * When strictFunctionTypes is true if there are no inferences for a type parameter then the type parameter itself will be returned instead of defaulting to `{}`. After chooseOverload returns a successful signature, the return type of that signature is checked and if the return type is a function type with a single call signature then any free type parameters found in that call signature are converted to type parameters for the call signature. If the return type is not a call signature then any free type parameters are converted to `{}` at that point. * inferFromSignatures will instantiate the source in the context of the target if the source signature has type parameters and strictFunctionTypes is true. * StrictFunctionTypes is required in both of the above cases because of errors that pop up otherwise when there are not contravariant inferences. * Seemingly free type parameters that are outerTypeParameters of the call being inferred are ignored instead of being erased. This is to avoid erasing type parameters when calling functions inside the body of a generic function. * When choosing an overload with multiple signatures that have contextually typed arguments, any contextual types that are assigned are reset when trying a new candidate. Updated baselines will be committed in the following commit.
1 parent f4a07ae commit 664c4d9

File tree

2 files changed

+332
-57
lines changed

2 files changed

+332
-57
lines changed

0 commit comments

Comments
 (0)