From d2bda47e80f94b60cc8971a55c39e86f1f6455ab Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Fri, 5 May 2017 12:39:47 -0700 Subject: [PATCH] fix inTypeAlias logic --- src/compiler/checker.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6ee3377d88a..5e7ce03afe1 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2297,7 +2297,6 @@ namespace ts { InFirstTypeArgument: boolean; // Writing first type argument of the instantiated type // TODO: ??? InTypeAlias: boolean; // Writing type in type alias declaration - checkAlias: boolean; symbolStack: Symbol[] | undefined; } @@ -2310,7 +2309,6 @@ namespace ts { InElementType: false, InFirstTypeArgument: false, InTypeAlias: false, - checkAlias: true, symbolStack: undefined }; } @@ -2319,6 +2317,8 @@ namespace ts { const InElementType = context.InElementType; // TODO: why doesn't tts unset the flag? context.InElementType = false; + const inTypeAlias = context.InTypeAlias; + context.InTypeAlias = false; // TODO: should be assert? if (!type) { @@ -2406,12 +2406,11 @@ namespace ts { return createTypeReferenceNode(name, /*typeArguments*/ undefined); } - if (!context.InTypeAlias && context.checkAlias && type.aliasSymbol) { + if (!inTypeAlias && type.aliasSymbol) { const name = symbolToName(type.aliasSymbol, /*expectsIdentifier*/ false, context); const typeArgumentNodes = type.aliasTypeArguments && mapToTypeNodeArray(type.aliasTypeArguments, /*addInElementTypeFlag*/ false); return createTypeReferenceNode(name, typeArgumentNodes); } - context.checkAlias = false; if (type.flags & (TypeFlags.Union | TypeFlags.Intersection)) { const types = type.flags & TypeFlags.Union ? formatUnionTypes((type).types) : (type).types;