From 9fb06c60a8aa236eb9fdb916e251d9439b21076c Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 3 Nov 2017 14:32:34 -0700 Subject: [PATCH] Call on never type is not an untyped function call --- src/compiler/checker.ts | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index af8bd6f7c98..eaf1b885544 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -16631,21 +16631,9 @@ namespace ts { * but is a subtype of the Function interface, the call is an untyped function call. */ function isUntypedFunctionCall(funcType: Type, apparentFuncType: Type, numCallSignatures: number, numConstructSignatures: number) { - if (isTypeAny(funcType)) { - return true; - } - if (isTypeAny(apparentFuncType) && funcType.flags & TypeFlags.TypeParameter) { - return true; - } - if (!numCallSignatures && !numConstructSignatures) { - // We exclude union types because we may have a union of function types that happen to have - // no common signatures. - if (funcType.flags & TypeFlags.Union) { - return false; - } - return isTypeAssignableTo(funcType, globalFunctionType); - } - return false; + // We exclude union types because we may have a union of function types that happen to have no common signatures. + return isTypeAny(funcType) || isTypeAny(apparentFuncType) && funcType.flags & TypeFlags.TypeParameter || + !numCallSignatures && !numConstructSignatures && !(funcType.flags & (TypeFlags.Union | TypeFlags.Never)) && isTypeAssignableTo(funcType, globalFunctionType); } function resolveNewExpression(node: NewExpression, candidatesOutArray: Signature[]): Signature {