Skip to content

Commit c377c44

Browse files
committed
Restore code from #52180
1 parent f0f477e commit c377c44

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/compiler/checker.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -25165,10 +25165,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2516525165
// and has inferences that would conflict. Otherwise, we prefer the contra-variant inference.
2516625166
const preferCovariantType = inferredCovariantType && (!inferredContravariantType ||
2516725167
!(inferredCovariantType.flags & TypeFlags.Never) &&
25168-
every(inference.candidates, t => isTypeSubtypeOf(t, inferredCovariantType)) &&
2516925168
some(inference.contraCandidates, t => isTypeSubtypeOf(inferredCovariantType, t)) &&
25170-
every(context.inferences, other => other === inference ||
25171-
getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter ||
25169+
every(context.inferences, other =>
25170+
other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter ||
2517225171
every(other.candidates, t => isTypeSubtypeOf(t, inferredCovariantType))));
2517325172
inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType;
2517425173
fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType;

0 commit comments

Comments
 (0)