File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -19311,6 +19311,7 @@ namespace ts {
19311
19311
19312
19312
function getTypeAtFlowBranchLabel(flow: FlowLabel): FlowType {
19313
19313
const antecedentTypes: Type[] = [];
19314
+ const containedUnions: Type[] = [];
19314
19315
let subtypeReduction = false;
19315
19316
let seenIncomplete = false;
19316
19317
for (const antecedent of flow.antecedents!) {
@@ -19330,6 +19331,7 @@ namespace ts {
19330
19331
return type;
19331
19332
}
19332
19333
pushIfUnique(antecedentTypes, type);
19334
+ pushIfUnique(containedUnions, containingUnion || type);
19333
19335
// If an antecedent type is not a subset of the declared type, we need to perform
19334
19336
// subtype reduction. This happens when a "foreign" type is injected into the control
19335
19337
// flow using the instanceof operator or a user defined type predicate.
@@ -19340,6 +19342,8 @@ namespace ts {
19340
19342
seenIncomplete = true;
19341
19343
}
19342
19344
}
19345
+ const containingUnionType = createFlowType(getUnionOrEvolvingArrayType(containedUnions, subtypeReduction ? UnionReduction.Subtype : UnionReduction.Literal), seenIncomplete);
19346
+ captureContainingUnion(containingUnionType);
19343
19347
return createFlowType(getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction ? UnionReduction.Subtype : UnionReduction.Literal), seenIncomplete);
19344
19348
}
19345
19349
You can’t perform that action at this time.
0 commit comments