Skip to content

Commit 9fb06c6

Browse files
committed
Call on never type is not an untyped function call
1 parent 1321d2a commit 9fb06c6

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

src/compiler/checker.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16631,21 +16631,9 @@ namespace ts {
1663116631
* but is a subtype of the Function interface, the call is an untyped function call.
1663216632
*/
1663316633
function isUntypedFunctionCall(funcType: Type, apparentFuncType: Type, numCallSignatures: number, numConstructSignatures: number) {
16634-
if (isTypeAny(funcType)) {
16635-
return true;
16636-
}
16637-
if (isTypeAny(apparentFuncType) && funcType.flags & TypeFlags.TypeParameter) {
16638-
return true;
16639-
}
16640-
if (!numCallSignatures && !numConstructSignatures) {
16641-
// We exclude union types because we may have a union of function types that happen to have
16642-
// no common signatures.
16643-
if (funcType.flags & TypeFlags.Union) {
16644-
return false;
16645-
}
16646-
return isTypeAssignableTo(funcType, globalFunctionType);
16647-
}
16648-
return false;
16634+
// We exclude union types because we may have a union of function types that happen to have no common signatures.
16635+
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && funcType.flags & TypeFlags.TypeParameter ||
16636+
!numCallSignatures && !numConstructSignatures && !(funcType.flags & (TypeFlags.Union | TypeFlags.Never)) && isTypeAssignableTo(funcType, globalFunctionType);
1664916637
}
1665016638

1665116639
function resolveNewExpression(node: NewExpression, candidatesOutArray: Signature[]): Signature {

0 commit comments

Comments
 (0)