@@ -9504,7 +9504,7 @@ namespace ts {
95049504 }
95059505 }
95069506 else if (sourceSignatures.length === 1 && targetSignatures.length === 1) {
9507- // For pure functions (functions with a single signature) we only erase type parameters for
9507+ // For simple functions (functions with a single signature) we only erase type parameters for
95089508 // the comparable relation. Otherwise, if the source signature is generic, we instantiate it
95099509 // in the context of the target signature before checking the relationship. Ideally we'd do
95109510 // this regardless of the number of signatures, but the potential costs are prohibitive due
@@ -15037,10 +15037,10 @@ namespace ts {
1503715037 // outer call expression. Effectively we just want a snapshot of whatever has been
1503815038 // inferred for any outer call expression so far.
1503915039 const instantiatedType = instantiateType(contextualType, cloneTypeMapper(getContextualMapper(node)));
15040- // If the contextual type is a generic pure function type, we instantiate the type with
15041- // its own type parameters and type arguments. This ensures that the type parameters are
15042- // not erased to type any during type inference such that they can be inferred as actual
15043- // types from the contextual type. For example:
15040+ // If the contextual type is a generic function type with a single call signature, we
15041+ // instantiate the type with its own type parameters and type arguments. This ensures that
15042+ // the type parameters are not erased to type any during type inference such that they can
15043+ // be inferred as actual types from the contextual type. For example:
1504415044 // declare function arrayMap<T, U>(f: (x: T) => U): (a: T[]) => U[];
1504515045 // const boxElements: <A>(a: A[]) => { value: A }[] = arrayMap(value => ({ value }));
1504615046 // Above, the type of the 'value' parameter is inferred to be 'A'.
0 commit comments