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 ae1e8d2 commit c691df9Copy full SHA for c691df9
src/compiler/checker.ts
@@ -15863,7 +15863,10 @@ namespace ts {
15863
}
15864
15865
15866
- if (unionParent && !result) {
+ if (unionParent && !result && targetIsOptional) {
15867
+ result = isRelatedTo(source, undefinedType);
15868
+ }
15869
+ if (unionParent && !result && source.flags & TypeFlags.Union) {
15870
// The easiest way to get the right errors here is to un-defer (which may be costly)
15871
// If it turns out this is too costly too often, we can replicate the error handling logic within
15872
// typeRelatedToSomeType without the discriminatable type branch (as that requires a manifest union
0 commit comments