Skip to content

Commit ed8ceba

Browse files
committed
Handle huge unions better in createUnionOrIntersectionProperty
1 parent 7ab2ad7 commit ed8ceba

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7769,7 +7769,7 @@ namespace ts {
77697769
}
77707770

77717771
function createUnionOrIntersectionProperty(containingType: UnionOrIntersectionType, name: __String): Symbol | undefined {
7772-
let props: Symbol[] | undefined;
7772+
const propSet = createMap<Symbol>();
77737773
let indexTypes: Type[] | undefined;
77747774
const isUnion = containingType.flags & TypeFlags.Union;
77757775
const excludeModifiers = isUnion ? ModifierFlags.NonPublicAccessibilityModifier : 0;
@@ -7784,7 +7784,7 @@ namespace ts {
77847784
const modifiers = prop ? getDeclarationModifierFlagsFromSymbol(prop) : 0;
77857785
if (prop && !(modifiers & excludeModifiers)) {
77867786
commonFlags &= prop.flags;
7787-
props = appendIfUnique(props, prop);
7787+
propSet.set("" + getSymbolId(prop), prop);
77887788
checkFlags |= (isReadonlySymbol(prop) ? CheckFlags.Readonly : 0) |
77897789
(!(modifiers & ModifierFlags.NonPublicAccessibilityModifier) ? CheckFlags.ContainsPublic : 0) |
77907790
(modifiers & ModifierFlags.Protected ? CheckFlags.ContainsProtected : 0) |
@@ -7806,6 +7806,7 @@ namespace ts {
78067806
}
78077807
}
78087808
}
7809+
const props = arrayFrom(propSet.values());
78097810
if (!props) {
78107811
return undefined;
78117812
}

0 commit comments

Comments
 (0)