From 0a28a3ec80c9b5e4f5bb5590598ba86ade2d1b02 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 6 May 2015 13:05:12 -0700 Subject: [PATCH] Remove getUnionTypeOfSubtypeConstituents --- src/compiler/checker.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a3ce22bbed1..4c5712299da 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3634,10 +3634,6 @@ module ts { return type; } - function getUnionTypeOfSubtypeConstituents(source: UnionType, target: Type): Type { - return getUnionType(filter(source.types, t => isTypeSubtypeOf(t, target))); - } - function getReducedTypeOfUnionType(type: UnionType): Type { // If union type was created without subtype reduction, perform the deferred reduction now if (!type.reducedType) { @@ -5399,7 +5395,7 @@ module ts { } // If the current type is a union type, remove all constituents that aren't subtypes of the target. if (type.flags & TypeFlags.Union) { - return getUnionTypeOfSubtypeConstituents(type, targetType); + return getUnionType(filter((type).types, t => isTypeSubtypeOf(t, targetType))); } } } @@ -5416,7 +5412,7 @@ module ts { let instanceType = getUnionType(map(constructSignatures, signature => getReturnTypeOfSignature(getErasedSignature(signature)))); // Pickup type from union types if (type.flags & TypeFlags.Union) { - return getUnionTypeOfSubtypeConstituents(type, instanceType); + return getUnionType(filter((type).types, t => isTypeSubtypeOf(t, instanceType))); } return instanceType; }