From a187b17e97fece8012bc8529ea3b1a9ebe4804e9 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 17 Aug 2017 13:09:21 -0700 Subject: [PATCH] Simplify mapped-type handling in computeBaseConstraint --- src/compiler/checker.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ff311177629..b3e7b01123d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5968,7 +5968,7 @@ namespace ts { function computeBaseConstraint(t: Type): Type { if (t.flags & TypeFlags.TypeParameter) { const constraint = getConstraintFromTypeParameter(t); - return ((t as TypeParameter).isThisType || !constraint || getObjectFlags(constraint) & ObjectFlags.Mapped) ? + return (t as TypeParameter).isThisType || !constraint ? constraint : getBaseConstraint(constraint); } @@ -5998,9 +5998,6 @@ namespace ts { const baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType) : undefined; return baseIndexedAccess && baseIndexedAccess !== unknownType ? getBaseConstraint(baseIndexedAccess) : undefined; } - if (isGenericMappedType(t)) { - return emptyObjectType; - } return t; } }