ProjectStack
typescript

TS2554: Expected N arguments, but got M

You called a function with the wrong number of arguments. TypeScript enforces the parameter count of every function call — extra arguments or missing required arguments are both caught at compile time.

Common causes

  • Passing too many arguments to a function that doesn't accept that many
  • Forgetting a required argument — all non-optional parameters must be provided
  • The function signature changed but the call sites weren't updated
  • Calling a method on the wrong type that has a different signature than expected

How to fix it

  1. Check the function signature and pass exactly the required arguments
  2. Make extra parameters optional if they shouldn't be required: function fn(a: string, b?: number)
  3. Add rest parameters if the function should accept any number of arguments: function fn(...args: string[])
  4. Update call sites to match the new function signature after a refactor

Example

function add(a: number, b: number): number { return a + b; } add(1, 2, 3); // error TS2554: Expected 2 arguments, but got 3.

Passing three arguments to a function that only accepts two

Browse more errors

The Developer Hub covers 150+ errors across Git, npm, Node.js, Python, TypeScript, and Docker — with plain-English explanations and fix steps.