TS2769: No overload matches this call
The function you're calling has multiple overload signatures, and your arguments don't match any of them exactly — the reported error can be long and confusing because TypeScript lists why each candidate overload failed. Read the LAST overload's specific mismatch first (it's usually the most general/relevant one), then check argument order, count, and types against it.
What causes this error
Some functions and methods — many DOM APIs, Express route handlers, and library functions — declare several overload signatures for different valid call shapes. TS2769 means none of them accept the exact arguments you passed. The error message stacks every overload's individual failure reason, which makes it look intimidating even when the actual mistake is small.
The Fix
// Example: addEventListener has overloads per event name/type
element.addEventListener('click', (event: Event) => {
event.targett; // typo — but the REAL error surfaces as No overload matches
});
// Read the error for the specific property/argument it flags, fix that first
element.addEventListener('click', (event: MouseEvent) => {
console.log(event.target); // fixed — correct property name and type
});When the error is long, scroll to the bottom overload candidate first — TypeScript generally lists the most specific, most likely intended signature last.
Common causes / variations
- A typo in a property/method name inside a callback, which manifests as an overload mismatch rather than a direct property error
- Passing arguments in the wrong order for an overloaded function
- Missing a required argument that only some of the overloads make optional
Related errors
See also: TS2345 Argument not assignable, TS2589 Type instantiation excessively deep.
Comments
Loading comments...