From 4e3751c07c1e7a89966c6efe962f6c790d11438f Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Mon, 27 Jul 2015 12:31:53 -0700 Subject: [PATCH] Use Debug.assert instead of Debug.fail; preserve 'any' variants --- src/compiler/checker.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7f22693ee25..6cf0893d7c7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7323,12 +7323,9 @@ namespace ts { * For example, in the element , the element instance type is `MyClass` (not `typeof MyClass`). */ function getJsxElementInstanceType(node: JsxOpeningLikeElement) { - if (!(getNodeLinks(node).jsxFlags & JsxFlags.ClassElement)) { - // There is no such thing as an instance type for a non-class element. This - // line shouldn't be hit. - Debug.fail('Should not call getJsxElementInstanceType on non-class Element'); - return undefined; - } + // There is no such thing as an instance type for a non-class element. This + // line shouldn't be hit. + Debug.assert(!!(getNodeLinks(node).jsxFlags & JsxFlags.ClassElement), 'Should not call getJsxElementInstanceType on non-class Element'); let classSymbol = getJsxElementTagSymbol(node); if (classSymbol === unknownSymbol) { @@ -7416,7 +7413,7 @@ namespace ts { let elemInstanceType = getJsxElementInstanceType(node); if (isTypeAny(elemInstanceType)) { - return links.resolvedJsxType = anyType; + return links.resolvedJsxType = elemInstanceType; } let propsName = getJsxElementPropertiesName();