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);