From 1575b7a77ebe402822b62825a33bbf224a9874fb 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 b7b5dff3e9d..30ffa37e1eb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7395,7 +7395,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);