From a75449cabc70de2ee74d7d9e4d37847d0e357f1f Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 21 Mar 2018 13:22:58 -0700 Subject: [PATCH] Revert strict containment check in checkInferType --- src/compiler/checker.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7351bae1539..49b89904bef 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -20605,8 +20605,7 @@ namespace ts { } function checkInferType(node: InferTypeNode) { - const ancestor = findAncestor(node, n => n.parent && n.parent.kind === SyntaxKind.ConditionalType); - if (!ancestor || (ancestor.parent).extendsType !== ancestor) { + if (!findAncestor(node, n => n.parent && n.parent.kind === SyntaxKind.ConditionalType && (n.parent).extendsType === n)) { grammarErrorOnNode(node, Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter);