Skip to content

Commit c691df9

Browse files
committed
Simplify fix
1 parent ae1e8d2 commit c691df9

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
@@ -15863,7 +15863,10 @@ namespace ts {
1586315863
}
1586415864
}
1586515865
}
15866-
if (unionParent && !result) {
15866+
if (unionParent && !result && targetIsOptional) {
15867+
result = isRelatedTo(source, undefinedType);
15868+
}
15869+
if (unionParent && !result && source.flags & TypeFlags.Union) {
1586715870
// The easiest way to get the right errors here is to un-defer (which may be costly)
1586815871
// If it turns out this is too costly too often, we can replicate the error handling logic within
1586915872
// typeRelatedToSomeType without the discriminatable type branch (as that requires a manifest union

0 commit comments

Comments
 (0)