mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
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.
This commit is contained in:
@@ -7632,11 +7632,9 @@ namespace ts {
|
||||
if (left.flags & TypeFlags.Any || right.flags & TypeFlags.Any) {
|
||||
return anyType;
|
||||
}
|
||||
left = filterType(left, t => !(t.flags & TypeFlags.Nullable));
|
||||
if (left.flags & TypeFlags.Never) {
|
||||
return right;
|
||||
}
|
||||
right = filterType(right, t => !(t.flags & TypeFlags.Nullable));
|
||||
if (right.flags & TypeFlags.Never) {
|
||||
return left;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user