From a92d5992d2b5b77a3ee1b8ce12a6e36e5927b28f Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 30 Aug 2019 16:39:31 -0700 Subject: [PATCH] Tweak isAliasedType --- src/compiler/checker.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 17023d6e5b6..c1b1496ccc4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9618,16 +9618,18 @@ namespace ts { return getTupleTypeOfArity(node.elementTypes.length, minLength, !!restElement, readonly, /*associatedNames*/ undefined); } + // Return true when the given node is transitively contained in type constructs that eagerly + // resolve their constituent types. We include SyntaxKind.TypeReference because type arguments + // of type aliases are eagerly resolved. function isAliasedType(node: Node): boolean { const parent = node.parent; switch (parent.kind) { case SyntaxKind.ParenthesizedType: - case SyntaxKind.ArrayType: - case SyntaxKind.TupleType: - case SyntaxKind.RestType: + case SyntaxKind.TypeReference: case SyntaxKind.UnionType: case SyntaxKind.IntersectionType: case SyntaxKind.IndexedAccessType: + case SyntaxKind.ConditionalType: return isAliasedType(parent); case SyntaxKind.TypeAliasDeclaration: return true;