This error, TS2555: Expected at least N arguments, but N were received., means a function was called with fewer arguments than it requires based on its definition. TypeScript is telling you that the caller must provide a certain minimum number of arguments for the function to operate correctly.

Here are the common reasons this happens and how to fix them:

1. Missing Required Arguments in Function Call

The most straightforward cause is simply forgetting to pass a parameter that the function definition explicitly lists as required.

Diagnosis: Examine the function definition. Look for parameters that do not have default values or are not marked as optional (?). Then, inspect every call site to ensure all these required parameters are being provided.

For example, if you have:

function greet(firstName: string, lastName: string) {
  console.log(`Hello, ${firstName} ${lastName}!`);
}

And you call it like this:

greet("Alice"); // TS2555: Expected 2 arguments, but 1 was received.

Fix: Provide all required arguments in the function call.

greet("Alice", "Smith"); // Correct

This works because you’re now satisfying the function’s explicit parameter list.

2. Incorrect Function Overload Signature Usage

If a function has multiple overload signatures, TypeScript picks the best match. If none of the overloads match exactly or if there’s an ambiguity that leads to an overload expecting more arguments, you can get this error.

Diagnosis: List all the overload signatures for the function. Pay close attention to the number and types of parameters in each. Then, look at the arguments you’re passing and see which overload TypeScript is trying to match. If it’s matching one that requires more arguments than you’re providing, that’s the problem.

Consider a scenario with overloads:

function process(data: string): void;
function process(data: number, options: { verbose: boolean }): void;
function process(data: any, options?: any): void {
  if (typeof data === 'string') {
    console.log(`Processing string: ${data}`);
  } else if (typeof data === 'number' && options?.verbose) {
    console.log(`Processing number ${data} verbosely.`);
  }
}

process(123); // TS2555: Expected at least 2 arguments, but 1 was received.

In this case, process(123) doesn’t match process(data: string). It could potentially match process(data: number, options: { verbose: boolean }), but since options is missing, TypeScript infers that you’re trying to call the overload that requires two arguments.

Fix: Ensure your call matches one of the exact overload signatures. If you intend to call the version that takes only a number, you need to adjust the overloads or how you call it. If the intention was to call the second overload, provide the missing argument.

process("some data"); // Matches the first overload
process(123, { verbose: false }); // Matches the second overload

This works because you are now providing arguments that precisely align with one of the declared overload signatures.

3. Spread Operator Issues with Tuple Types

When using the spread operator (...) with a tuple type, TypeScript can be very strict about the number of elements. If you spread a tuple into a function call that expects a specific number of arguments, and the tuple doesn’t have exactly that many elements, you might hit this error.

Diagnosis: Check the type of the array or tuple being spread. If it’s a tuple like [string, number], and you spread it into a function expecting three arguments, TypeScript will complain.

function configure(timeout: number, retries: number, delay: number) {
  console.log(`Timeout: ${timeout}, Retries: ${retries}, Delay: ${delay}`);
}

const settings: [number, number] = [5000, 3];
configure(...settings); // TS2555: Expected 3 arguments, but 2 were received.

Fix: Ensure the spread tuple has the correct number of elements to match the function’s parameters, or adjust the function call to accommodate the spread.

const settings: [number, number, number] = [5000, 3, 1000];
configure(...settings); // Correct

Alternatively, if the function can handle fewer arguments (e.g., with defaults), ensure the function definition supports that.

4. Incorrectly Typed Array/Tuple Being Spread

This is similar to the above but focuses on the type of the elements within the spread array/tuple. Even if the number of elements is correct, if their types don’t align with the function’s parameter types, you might see this error, or a related type mismatch error. However, sometimes the mismatch leads to the argument count error if TypeScript can’t infer a valid assignment.

Diagnosis: Inspect the types of the elements in the array/tuple being spread. Compare them against the parameter types of the function.

function sendEvent(name: string, payload: object, timestamp: Date) {
  console.log(`Event: ${name}, Payload: ${JSON.stringify(payload)}, Time: ${timestamp.toISOString()}`);
}

const eventData = ["click", { button: "submit" }, Date.now()]; // Date.now() returns a number, not a Date object
sendEvent(...eventData); // TS2555: Expected 3 arguments, but 3 were received. (This might manifest as a type error first, but can lead to argument count issues if not caught early)

While this specific example often results in a type error on timestamp first, in more complex scenarios or with certain compiler flags, it can manifest as an argument count issue if TypeScript can’t resolve the type compatibility.

Fix: Ensure the types of the elements being spread perfectly match the expected parameter types.

const eventData = ["click", { button: "submit" }, new Date()]; // Correct type for timestamp
sendEvent(...eventData); // Correct

This works because the types now align, allowing TypeScript to correctly infer the function call signature.

5. Misunderstanding Optional Parameters or Rest Parameters

You might be incorrectly assuming a parameter is optional when it’s not, or misinterpreting how rest parameters (...rest) work.

Diagnosis: Carefully review the function signature.

  • Optional parameters: Marked with ? (e.g., optionalParam?: string). These can be omitted.
  • Default parameters: Have a value assigned in the signature (e.g., param = defaultValue). These can be omitted, and the default will be used.
  • Rest parameters: ...restParam: Type[]. These gather remaining arguments into an array. A function can only have one rest parameter, and it must be the last one.

If you omit an optional or default parameter, you might get TS2555 if the remaining required parameters are then shifted and the function’s minimum argument count is effectively increased from the perspective of the call.

function logMessage(level: "info" | "warn" | "error", message: string, timestamp?: number) {
  console.log(`[${level.toUpperCase()}] ${message} (at ${timestamp ?? Date.now()})`);
}

logMessage("info", "User logged in"); // This is fine, timestamp is optional.
logMessage("warn"); // TS2555: Expected 2 arguments, but 1 was received. (message is missing)

Fix: Provide all parameters that are not optional or do not have default values. If you are using rest parameters, ensure they are correctly placed and that you are not trying to pass arguments after the rest parameter has been "filled" if the function expects more fixed arguments.

logMessage("warn", "Disk space low"); // Correct

This works because you’re supplying the required message parameter.

6. Incorrectly Typed Callback Functions

When passing callback functions, especially those with specific signatures, ensure you’re providing all their required arguments.

Diagnosis: Examine the expected signature of the callback parameter in the function you’re calling. Then, look at the signature of the callback function you’re providing.

function performOperation(data: number[], callback: (a: number, b: number) => void) {
  if (data.length >= 2) {
    callback(data[0], data[1]);
  }
}

const numbers = [10, 20, 30];
performOperation(numbers, (a) => { // Callback expects two arguments (a, b), but only 'a' is provided.
  console.log(a * 2);
}); // TS2555: Expected 2 arguments, but 1 was received. (This refers to the callback's parameters)

Fix: Ensure your callback function has the correct number and types of parameters as expected by the function it’s passed to.

performOperation(numbers, (a, b) => {
  console.log(a * b); // Correct, uses both arguments
});

This works because the provided callback now matches the signature required by performOperation.

After fixing these, you might encounter TS2345: Argument of type 'X' is not assignable to parameter of type 'Y'. if type mismatches were also present.

Want structured learning?

Take the full Typescript course →