File tree 1 file changed +8
-4
lines changed 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -12721,11 +12721,15 @@ namespace ts {
12721
12721
if (checkType.flags & TypeFlags.Any) {
12722
12722
(extraTypes || (extraTypes = [])).push(instantiateType(root.trueType, combinedMapper || mapper));
12723
12723
}
12724
- // If falseType is an immediately nested conditional type, switch to that type and loop.
12724
+ // If falseType is an immediately nested conditional type that isn't distributive or has an
12725
+ // identical checkType, switch to that type and loop.
12725
12726
const falseType = root.falseType;
12726
- if (falseType.flags & TypeFlags.Conditional && (<ConditionalType>falseType).root.node.parent === root.node) {
12727
- root = (<ConditionalType>falseType).root;
12728
- continue;
12727
+ if (falseType.flags & TypeFlags.Conditional) {
12728
+ const newRoot = (<ConditionalType>falseType).root;
12729
+ if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) {
12730
+ root = newRoot;
12731
+ continue;
12732
+ }
12729
12733
}
12730
12734
result = instantiateType(falseType, mapper);
12731
12735
break;
You can’t perform that action at this time.
0 commit comments