• Error
  • Reported by the type checker

TS2575

No overload expects {0} arguments, but overloads do exist that expect either {1} or {2} arguments.

A call passes an argument count that no overload accepts, though overloads exist for counts on either side. Pass the number one overload expects.

What it means

The function has several overload signatures, and the call passes a number of arguments that falls between the counts they accept. For example, overloads for 1 and 3 arguments, called with 2.

Example

index.ts
function pick(a: string): string;
function pick(a: string, b: string, c: string): string;
function pick(a: string, b?: string, c?: string): string { return a + (b ?? "") + (c ?? ""); }
pick("x", "y");
export {};
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(4,1): error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 3 arguments.

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

  • Pass the number of arguments one of the overloads expects.
  • If the in-between count should be allowed, add an overload signature for it.