Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28359,7 +28359,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 {
Expand Down
11 changes: 11 additions & 0 deletions tests/baselines/reference/neverIntersectionNotCallable.errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
tests/cases/conformance/types/never/neverIntersectionNotCallable.ts(2,1): error TS2349: This expression is not callable.
Type 'never' has no call signatures.


==== tests/cases/conformance/types/never/neverIntersectionNotCallable.ts (1 errors) ====
declare const f: { (x: string): number, a: "" } & { a: number }
f()
~
!!! error TS2349: This expression is not callable.
!!! error TS2349: Type 'never' has no call signatures.

7 changes: 7 additions & 0 deletions tests/baselines/reference/neverIntersectionNotCallable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//// [neverIntersectionNotCallable.ts]
declare const f: { (x: string): number, a: "" } & { a: number }
f()


//// [neverIntersectionNotCallable.js]
f();
10 changes: 10 additions & 0 deletions tests/baselines/reference/neverIntersectionNotCallable.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
=== tests/cases/conformance/types/never/neverIntersectionNotCallable.ts ===
declare const f: { (x: string): number, a: "" } & { a: number }
>f : Symbol(f, Decl(neverIntersectionNotCallable.ts, 0, 13))
>x : Symbol(x, Decl(neverIntersectionNotCallable.ts, 0, 20))
>a : Symbol(a, Decl(neverIntersectionNotCallable.ts, 0, 39))
>a : Symbol(a, Decl(neverIntersectionNotCallable.ts, 0, 51))

f()
>f : Symbol(f, Decl(neverIntersectionNotCallable.ts, 0, 13))

11 changes: 11 additions & 0 deletions tests/baselines/reference/neverIntersectionNotCallable.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
=== tests/cases/conformance/types/never/neverIntersectionNotCallable.ts ===
declare const f: { (x: string): number, a: "" } & { a: number }
>f : never
>x : string
>a : ""
>a : number

f()
>f() : any
>f : never

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const f: { (x: string): number, a: "" } & { a: number }
f()