mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 19:55:08 -06:00
Call on never type is not an untyped function call
This commit is contained in:
parent
1321d2ae31
commit
9fb06c60a8
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user