Skip to content

Commit 4e59e52

Browse files
committed
1 parent 5f183ad commit 4e59e52

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

src/compiler/checker.ts

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27888,24 +27888,22 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2788827888
for (const type of types) {
2788927889
if (type.flags & (TypeFlags.Object | TypeFlags.Intersection | TypeFlags.InstantiableNonPrimitive)) {
2789027890
const discriminant = getTypeOfPropertyOfType(type, name);
27891-
if (discriminant) {
27892-
if (!isLiteralType(discriminant)) {
27893-
return undefined;
27894-
}
27895-
let duplicate = false;
27896-
forEachType(discriminant, t => {
27897-
const id = getTypeId(getRegularTypeOfLiteralType(t));
27898-
const existing = map.get(id);
27899-
if (!existing) {
27900-
map.set(id, type);
27901-
}
27902-
else if (existing !== unknownType) {
27903-
map.set(id, unknownType);
27904-
duplicate = true;
27905-
}
27906-
});
27907-
if (!duplicate) count++;
27891+
if (!discriminant || !isLiteralType(discriminant)) {
27892+
return undefined;
2790827893
}
27894+
let duplicate = false;
27895+
forEachType(discriminant, t => {
27896+
const id = getTypeId(getRegularTypeOfLiteralType(t));
27897+
const existing = map.get(id);
27898+
if (!existing) {
27899+
map.set(id, type);
27900+
}
27901+
else if (existing !== unknownType) {
27902+
map.set(id, unknownType);
27903+
duplicate = true;
27904+
}
27905+
});
27906+
if (!duplicate) count++;
2790927907
}
2791027908
}
2791127909
return count >= 10 && count * 2 >= types.length ? map : undefined;

0 commit comments

Comments
 (0)