Skip to content

Commit c6c1e95

Browse files
committed
PR feedback
1 parent c6935b4 commit c6c1e95

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15582,7 +15582,10 @@ namespace ts {
1558215582
}
1558315583
}
1558415584
}
15585-
if (unionParent && !result) {
15585+
if (unionParent && !result && targetIsOptional) {
15586+
result = isRelatedTo(source, undefinedType);
15587+
}
15588+
if (unionParent && !result && source.flags & TypeFlags.Union) {
1558615589
// The easiest way to get the right errors here is to un-defer (which may be costly)
1558715590
// If it turns out this is too costly too often, we can replicate the error handling logic within
1558815591
// typeRelatedToSomeType without the discriminatable type branch (as that requires a manifest union

0 commit comments

Comments
 (0)