File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -11976,22 +11976,20 @@ namespace ts {
11976
11976
bestMatch = target;
11977
11977
matchingCount = Infinity;
11978
11978
}
11979
- else if (isLiteralType( overlap) ) {
11979
+ else if (overlap.flags & TypeFlags.Union ) {
11980
11980
// We only want to account for literal types otherwise.
11981
11981
// If we have a union of index types, it seems likely that we
11982
11982
// needed to elaborate between two generic mapped types anyway.
11983
- if (overlap.flags & TypeFlags.Union) {
11984
- const len = length(filter((overlap as UnionType).types, isUnitType));
11985
- if (len >= matchingCount) {
11986
- bestMatch = target;
11987
- matchingCount = len;
11988
- }
11989
- }
11990
- else if (1 >= matchingCount) {
11983
+ const len = length(filter((overlap as UnionType).types, isUnitType));
11984
+ if (len >= matchingCount) {
11991
11985
bestMatch = target;
11992
- matchingCount = 1 ;
11986
+ matchingCount = len ;
11993
11987
}
11994
11988
}
11989
+ else if (isUnitType(overlap) && 1 >= matchingCount) {
11990
+ bestMatch = target;
11991
+ matchingCount = 1;
11992
+ }
11995
11993
}
11996
11994
return bestMatch;
11997
11995
}
You can’t perform that action at this time.
0 commit comments