Skip to content

Commit f59229b

Browse files
committed
Only add unique inferences to candidate arrays
1 parent 2721571 commit f59229b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
3-
41
/* @internal */
52
namespace ts {
63
const ambientModuleSymbolRegex = /^".+"$/;
@@ -13553,10 +13550,10 @@ namespace ts {
1355313550
// We make contravariant inferences only if we are in a pure contravariant position,
1355413551
// i.e. only if we have not descended into a bivariant position.
1355513552
if (contravariant && !bivariant) {
13556-
inference.contraCandidates = append(inference.contraCandidates, candidate);
13553+
inference.contraCandidates = appendIfUnique(inference.contraCandidates, candidate);
1355713554
}
1355813555
else {
13559-
inference.candidates = append(inference.candidates, candidate);
13556+
inference.candidates = appendIfUnique(inference.candidates, candidate);
1356013557
}
1356113558
}
1356213559
if (!(priority & InferencePriority.ReturnType) && target.flags & TypeFlags.TypeParameter && !isTypeParameterAtTopLevel(originalTarget, <TypeParameter>target)) {

0 commit comments

Comments
 (0)