Skip to content
Latchkey

tsc TS2554: Expected N arguments, but got M in CI

TS2554 is an arity error: the call passes a different number of arguments than the signature declares. It often appears after a function gains a required parameter that not every call site was updated for.

What this error means

tsc fails with "error TS2554: Expected 2 arguments, but got 1." (or the reverse), pointing at the call and noting which parameter was not provided.

tsc
src/app.ts:12:3 - error TS2554: Expected 2 arguments, but got 1.

12   connect(url);
     ~~~~~~~~~~~~
  An argument for 'options' was not provided.

Common causes

A required parameter was added to the signature

The function now declares a parameter that older call sites do not pass, so the call is short one argument.

A call passes more arguments than declared

Extra arguments are passed to a function with a fixed arity, which tsc rejects unless the signature uses a rest parameter.

How to fix it

Update the call to match the signature

  1. Read which parameter the error says was not provided.
  2. Pass the missing argument, or remove the extra one.
  3. Re-run tsc to confirm the arity matches.
src/app.ts
connect(url, { timeout: 5000 });

Make a new parameter optional when callers cannot all change

If you cannot update every call site at once, declare the added parameter optional with a default so existing calls remain valid.

src/app.ts
function connect(url: string, options: Options = {}) { /* ... */ }

How to prevent it

  • Add new parameters as optional with a default when possible.
  • Update all call sites in the same change as a signature change.
  • Run tsc across the whole project, not just touched files.

Frequently asked questions

What causes "TS2554 "Expected N arguments, but got M""?
The function now declares a parameter that older call sites do not pass, so the call is short one argument.
How do I fix TS2554 "Expected N arguments, but got M"?
Update the call to match the signature

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card