We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c6935b4 commit c6c1e95Copy full SHA for c6c1e95
src/compiler/checker.ts
@@ -15582,7 +15582,10 @@ namespace ts {
15582
}
15583
15584
15585
- if (unionParent && !result) {
+ if (unionParent && !result && targetIsOptional) {
15586
+ result = isRelatedTo(source, undefinedType);
15587
+ }
15588
+ if (unionParent && !result && source.flags & TypeFlags.Union) {
15589
// The easiest way to get the right errors here is to un-defer (which may be costly)
15590
// If it turns out this is too costly too often, we can replicate the error handling logic within
15591
// typeRelatedToSomeType without the discriminatable type branch (as that requires a manifest union
0 commit comments