Skip to content

Commit 93465bd

Browse files
committed
Filter nullables after lifting union over spread
Previously, null/undefined were removed upfront, which is incorrect. Now nullable types are removed with other non-primitives after union is lifted over spread. This produces unions, which are larger, but more correct.
1 parent ea830d4 commit 93465bd

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

src/compiler/checker.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7632,11 +7632,9 @@ namespace ts {
76327632
if (left.flags & TypeFlags.Any || right.flags & TypeFlags.Any) {
76337633
return anyType;
76347634
}
7635-
left = filterType(left, t => !(t.flags & TypeFlags.Nullable));
76367635
if (left.flags & TypeFlags.Never) {
76377636
return right;
76387637
}
7639-
right = filterType(right, t => !(t.flags & TypeFlags.Nullable));
76407638
if (right.flags & TypeFlags.Never) {
76417639
return left;
76427640
}

0 commit comments

Comments
 (0)