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