← Debugging Guides

阅读中文版本

TypeScript — TS2769: No overload matches this call

Debug TS2769 by reading the overload list and matching argument types to the intended signature.

intermediatedebuggingtypescript

Symptoms

  • error TS2769: No overload matches this call
  • The final overload is not compatible with this call
  • Passing an options object fails while positional args work
  • A generic library function rejects a callback

Possible causes

  • The argument types do not match any declared overload
  • An object argument has an excess or missing property
  • A callback parameter type is incompatible with the expected signature
  • The correct overload was removed or renamed in a version upgrade

Diagnosis steps

Read the overloads in the error

npx tsc --noEmit --pretty false

Interpretation

The message lists candidate signatures. Comparing the arguments against each shows which constraint fails.

Minimize the call to isolate the mismatch

// reduce to one argument at a time

Interpretation

Removing optional arguments until the error changes identifies the offending argument.

Check the library version types

npm ls <lib> && cat node_modules/<lib>/package.json | grep types

Interpretation

An upgrade can change overloads, so matching the installed types explains a failure that appeared after install.

Root cause

None of the overloaded signatures accepts the argument types provided, because of a type mismatch, an excess property in an object literal, or a change in the library types.

Fix

Conform the arguments to the intended overload by fixing types, removing excess properties or supplying the option the overload requires, and update calls when a library changes its signatures.

Verify the fix

Rerun the type checker and confirm the call type-checks, then run tests covering the call to confirm runtime behavior is unchanged.

Symptom walkthrough

The compiler reports TS2769, no overload matches this call, and lists the signatures it tried. The failure indicates that the provided arguments satisfy none of them, often because of an excess property in an object literal, a callback whose parameter type differs from the expected one, or a changed signature after a library upgrade.

Fix in practice

Compare the arguments against each listed overload and make them conform: fix the mismatched type, remove excess properties, or pass the option the chosen overload requires. When the library itself changed, update the call site to the new signature rather than forcing a cast.

Verification

Rerun the type checker and confirm the call compiles, then run the tests that exercise it. A call that type-checks and behaves correctly at runtime confirms the arguments now match the intended overload.

Diagnostic commands

Check the behavior with commands like these:

npx tsc --noEmit --pretty false
// reduce to one argument at a time
npm ls <lib> && cat node_modules/<lib>/package.json | grep types