Ad Space — Top Banner

TS2769

TypeScript Programming Language

Severity: Moderate

What Does This Error Mean?

You called a function with arguments that do not match any of its defined overloads. TypeScript lists all the overload signatures it tried and rejected. Fix the argument types or values to match one of the valid overload signatures.

Affected Models

  • TypeScript 5.x
  • TypeScript 4.x
  • React + TypeScript
  • Node.js + TypeScript

Common Causes

  • Passing an incorrect combination of argument types to an overloaded function
  • Passing null or undefined to an overload that does not accept it
  • A library function has strict overloads and your arguments do not match any variant
  • Using a union type value where each overload requires a specific branch of the union
  • The TypeScript version of the library is outdated and missing the overload you need

How to Fix It

  1. Expand the full error — TypeScript lists each overload it tried and why it rejected it.

    Click the error in VS Code to see all rejected overloads. The closest mismatch is usually at the bottom of the list.

  2. Identify which overload you intend to use and check its exact parameter types.

    Look at the library's type definitions or docs.rs equivalent to find the correct signature.

  3. Convert or narrow your argument to match the expected overload.

    If an overload needs a string but you have string | null, add a null check to narrow the type first.

  4. Check if a newer version of the library's @types package adds the overload you need.

    Run npm update @types/library-name to get the latest type definitions.

  5. As a last resort, cast your argument with 'as' to match the expected type.

    Example: myFunc(value as string) — use this only if you are certain the type is correct at runtime.

When to Call a Professional

TS2769 is safe to fix yourself in most cases. If it comes from a complex library like React or lodash with many overloads, the library's documentation lists valid signatures.

Frequently Asked Questions

What is a function overload in TypeScript?

An overload lets one function have multiple valid signatures. Example: a function that accepts (string) or (number, boolean) but not (string, boolean). TypeScript checks which signature your call matches.

Why does TypeScript show multiple overload errors at once?

TypeScript tries each overload in order and reports why each failed. This is helpful — the last entry in the list usually shows the closest match and the actual problem. Focus on the last overload error first.

Can I add my own overload to a library function?

Yes — using declaration merging you can extend a module's types. Create a .d.ts file and redeclare the function with an additional overload signature. This is an advanced technique — check the TypeScript docs on declaration merging.