Never-reducing intersections are not untyped function call targets (#42917)

* Never-reducing intersections are not untyped function call targets

* Don’t attempt to reduce union types
This commit is contained in:
Andrew Branch authored and GitHub committed 2021-02-23 17:22:41 -08:00
1 parent 8d58c8d90b
commit 56cf2e68e8
6 files changed
+42 -1

No files matched your search

+1 -1
View File
@@ -28474,7 +28474,7 @@ namespace ts {
function isUntypedFunctionCall(funcType: Type, apparentFuncType: Type, numCallSignatures: number, numConstructSignatures: number): boolean {
// 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 && !(apparentFuncType.flags & (TypeFlags.Union | TypeFlags.Never)) && isTypeAssignableTo(funcType, globalFunctionType);
!numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & TypeFlags.Union) && !(getReducedType(apparentFuncType).flags & TypeFlags.Never) && isTypeAssignableTo(funcType, globalFunctionType);
}
function resolveNewExpression(node: NewExpression, candidatesOutArray: Signature[] | undefined, checkMode: CheckMode): Signature {