Skip to content

Commit 02963b4

Browse files
authored
Merge pull request #30443 from Microsoft/fixTypeInferenceLogicError
Fix logic error introduced in #30334
2 parents 36cf12f + 084d14a commit 02963b4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14613,9 +14613,11 @@ namespace ts {
1461314613
const candidate = propagationType || source;
1461414614
// We make contravariant inferences only if we are in a pure contravariant position,
1461514615
// i.e. only if we have not descended into a bivariant position.
14616-
if (contravariant && !bivariant && !contains(inference.contraCandidates, candidate)) {
14617-
inference.contraCandidates = append(inference.contraCandidates, candidate);
14618-
inference.inferredType = undefined;
14616+
if (contravariant && !bivariant) {
14617+
if (!contains(inference.contraCandidates, candidate)) {
14618+
inference.contraCandidates = append(inference.contraCandidates, candidate);
14619+
inference.inferredType = undefined;
14620+
}
1461914621
}
1462014622
else if (!contains(inference.candidates, candidate)) {
1462114623
inference.candidates = append(inference.candidates, candidate);

0 commit comments

Comments
 (0)