diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7cfa484118e..a10bfe1d18c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7245,7 +7245,7 @@ namespace ts { function getConstrainedTypeParameter(typeParameter: TypeParameter, node: Node) { let constraints: Type[]; - while (isTypeNode(node)) { + while (isPartOfTypeNode(node)) { const parent = node.parent; if (parent.kind === SyntaxKind.ConditionalType && node === (parent).trueType) { if (getTypeFromTypeNode((parent).checkType) === typeParameter) { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 388ce814cc3..3c76bcf3119 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -771,6 +771,8 @@ namespace ts { return node.parent.kind !== SyntaxKind.VoidExpression; case SyntaxKind.ExpressionWithTypeArguments: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); + case SyntaxKind.TypeParameter: + return node.parent.kind === SyntaxKind.MappedType || node.parent.kind === SyntaxKind.InferType; // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container