diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 394f13bc2cc..8f1faaa368b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11981,7 +11981,7 @@ namespace ts { // If we have a union of index types, it seems likely that we // needed to elaborate between two generic mapped types anyway. if (overlap.flags & TypeFlags.Union) { - const len = length((overlap as UnionType).types); + const len = length(filter((overlap as UnionType).types, isUnitType)); if (len >= matchingCount) { bestMatch = target; matchingCount = len;