From 6911acf80b712051db3833162eb68c3d3f79d13c Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 2 Nov 2017 14:28:46 -0700 Subject: [PATCH] Remove freshness from literal types in intersections --- src/compiler/checker.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 09354d957a3..7c8386e5580 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7589,11 +7589,11 @@ namespace ts { } } - // Add the given types to the given type set. Order is preserved, duplicates are removed, - // and nested types of the given kind are flattened into the set. + // Add the given types to the given type set. Order is preserved, freshness is removed from literal + // types, duplicates are removed, and nested types of the given kind are flattened into the set. function addTypesToIntersection(typeSet: TypeSet, types: Type[]) { for (const type of types) { - addTypeToIntersection(typeSet, type); + addTypeToIntersection(typeSet, getRegularTypeOfLiteralType(type)); } }