File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -7771,18 +7771,14 @@ namespace ts {
7771
7771
if (target.flags & TypeFlags.Union && containsType(targetTypes, source)) {
7772
7772
return Ternary.True;
7773
7773
}
7774
- const discriminantType = findMatchingDiscriminantType(source, target);
7775
- if (discriminantType) {
7776
- return isRelatedTo(source, discriminantType, reportErrors);
7777
- }
7778
-
7779
- const len = targetTypes.length;
7780
- for (let i = 0; i < len; i++) {
7781
- const related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1);
7774
+ for (const type of targetTypes) {
7775
+ const related = isRelatedTo(source, type, /*reportErrors*/ false);
7782
7776
if (related) {
7783
7777
return related;
7784
7778
}
7785
7779
}
7780
+ const discriminantType = findMatchingDiscriminantType(source, target);
7781
+ isRelatedTo(source, discriminantType || targetTypes[targetTypes.length - 1], reportErrors);
7786
7782
return Ternary.False;
7787
7783
}
7788
7784
You can’t perform that action at this time.
0 commit comments