From 93465bdae2af3cd8a940c4fa3d75e4f00d73d048 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 6 Jun 2017 14:11:01 -0700 Subject: [PATCH] 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. --- src/compiler/checker.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1cc91550dc0..82459d6afbe 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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; }