From 12460d5b03ca87fe6d74a5e10349f9b8b4dd3fc0 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 d865df5cfd5..ba620e01d38 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -20624,8 +20624,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);