From 052680d4ea3b0d6689d9fae1e59bd53099a9bbd5 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 29 Mar 2018 10:16:31 -0700 Subject: [PATCH] Fix parent node walk termination condition in getConstrainedTypeVariable --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ee0bcbea014..13b8512c64f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7393,7 +7393,7 @@ namespace ts { function getConstrainedTypeVariable(typeVariable: TypeVariable, node: Node) { let constraints: Type[]; - while (isPartOfTypeNode(node)) { + while (node && !isStatement(node)) { const parent = node.parent; if (parent.kind === SyntaxKind.ConditionalType && node === (parent).trueType) { const constraint = getImpliedConstraint(typeVariable, (parent).checkType, (parent).extendsType);