πŸ”§ Error Fixes
Β· 1 min read

TypeScript: No Overload Matches This Call β€” How to Fix It


No overload matches this call

You’re calling a function with arguments that don’t match any of its overload signatures.

Why this happens

Some TypeScript functions define multiple overload signatures β€” different combinations of parameter types they accept. When none of the overloads match your arguments, TypeScript reports this error. It’s common with DOM APIs, library functions, and generic utilities that have strict type constraints per overload.

Fix 1: Check the function signature

Hover over the function in your editor to see what arguments it expects.

// addEventListener has specific overloads
// ❌ Wrong event name
element.addEventListener("clck", handler);

// βœ… Correct
element.addEventListener("click", handler);

Fix 2: Fix the callback signature

// ❌ Wrong callback type
document.addEventListener("click", (e: KeyboardEvent) => {});

// βœ… Match the event type
document.addEventListener("click", (e: MouseEvent) => {});

Fix 3: Check library version

The overloads might have changed in a newer version. Check the library’s changelog.

Alternative solutions

If you’re writing your own overloaded function and hitting this error in tests, simplify by using a union type instead of overloads:

// Instead of multiple overloads
function parse(input: string): string;
function parse(input: number): number;

// βœ… Use a union
function parse(input: string | number): string | number {
  return typeof input === 'string' ? input.trim() : input * 2;
}

Prevention

  • Let TypeScript infer callback parameter types instead of annotating them manually β€” incorrect annotations are the most common cause.
  • Keep @types/* packages in sync with their corresponding library versions.

Related: TypeScript: Type X Is Not Assignable to Type Y Β· What is TypeScript

πŸ“˜