@@ -8129,8 +8129,9 @@ namespace ts {
81298129 if (inferTypeParameters) {
81308130 const inferences = map(inferTypeParameters, createInferenceInfo);
81318131 // We don't want inferences from constraints as they may cause us to eagerly resolve the
8132- // conditional type instead of deferring resolution.
8133- inferTypes(inferences, checkType, extendsType, InferencePriority.NoConstraints);
8132+ // conditional type instead of deferring resolution. Also, we always want strict function
8133+ // types rules (i.e. proper contravariance) for inferences.
8134+ inferTypes(inferences, checkType, extendsType, InferencePriority.NoConstraints | InferencePriority.AlwaysStrict);
81348135 // We infer 'never' when there are no candidates for a type parameter
81358136 const inferredTypes = map(inferences, inference => getTypeFromInference(inference) || neverType);
81368137 const inferenceMapper = createTypeMapper(inferTypeParameters, inferredTypes);
@@ -11510,7 +11511,7 @@ namespace ts {
1151011511 }
1151111512
1151211513 function inferFromContravariantTypes(source: Type, target: Type) {
11513- if (strictFunctionTypes) {
11514+ if (strictFunctionTypes || priority & InferencePriority.AlwaysStrict ) {
1151411515 contravariant = !contravariant;
1151511516 inferFromTypes(source, target);
1151611517 contravariant = !contravariant;
0 commit comments