File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -22329,12 +22329,11 @@ namespace ts {
2232922329 if (signature) {
2233022330 const inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : undefined;
2233122331 if (inference.contraCandidates) {
22332- const inferredContravariantType = getContravariantInference(inference);
2233322332 // If we have both co- and contra-variant inferences, we prefer the contra-variant inference
22334- // unless the co-variant inference is a subtype and not 'never'.
22333+ // unless the co-variant inference is a subtype of some contra-variant inference and not 'never'.
2233522334 inferredType = inferredCovariantType && !(inferredCovariantType.flags & TypeFlags.Never) &&
22336- isTypeSubtypeOf(inferredCovariantType, inferredContravariantType ) ?
22337- inferredCovariantType : inferredContravariantType ;
22335+ some(inference.contraCandidates, t => isTypeSubtypeOf(inferredCovariantType, t) ) ?
22336+ inferredCovariantType : getContravariantInference(inference) ;
2233822337 }
2233922338 else if (inferredCovariantType) {
2234022339 inferredType = inferredCovariantType;
You can’t perform that action at this time.
0 commit comments