- Error
- Reported by the type checker
TS2769
No overload matches this call.
A call matches none of the function's overloads. Read the per-overload errors in the message and fix the arguments.
What it means
The function has several overload signatures and the arguments don't fit any of them. The message then lists, for each overload, why it didn't match.
Example
function parse(x: string): number;
function parse(x: number): string;
function parse(x: string | number): string | number { return x; }
parse(true);
export {};
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(4,7): error TS2769: No overload matches this call.
Overload 1 of 2, '(x: string): number', gave the following error.
Argument of type 'boolean' is not assignable to parameter of type 'string'.
Overload 2 of 2, '(x: number): string', gave the following error.
Argument of type 'boolean' is not assignable to parameter of type 'number'.
Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.
How to fix
- Read the indented lines: each one says why a particular overload was rejected.
- Change the arguments to match the overload you intended.
- If the call should be allowed, add an overload for it.