mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-07 14:13:54 -06: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:
parent
ea830d4fad
commit
93465bdae2
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user