TS2769Semantic Error
Since TS 1.0

Fix TS2769: No Overload Matches This Call

Learn why TypeScript throws TS2769 when no function overload matches the provided arguments, and how to fix overload resolution errors.

error TS2769: No overload matches this call

What This Error Means

TypeScript error TS2769 occurs when you call a function that has multiple overload signatures and none of them match the arguments you passed. Overloaded functions define several ways they can be called — different parameter types, different numbers of parameters, or different combinations. When TypeScript cannot match your call to any of these signatures, it throws TS2769.

This error is common with built-in APIs like addEventListener, fetch, React's useState, and library functions that accept different argument shapes. The error message can look intimidating because TypeScript lists every overload it tried and why each failed, but the fix is usually straightforward once you know how to read it.

Common Causes

1. Wrong argument type passed to an overloaded function

The most common cause — you are passing a value of the wrong type to a function with multiple signatures.

// ❌ Error: No overload matches this call. (TS2769)
// addEventListener expects specific event type strings
document.addEventListener('onclick', (event) => {
  console.log(event.target)
})
// ✅ Use the correct event name (without the "on" prefix)
document.addEventListener('click', (event) => {
  console.log(event.target)
})

2. Passing the wrong number of arguments

Some overloaded functions expect different argument counts for different use cases.

// ❌ Error: No overload matches this call. (TS2769)
const headers = new Headers()
// set() expects exactly 2 arguments: name and value
headers.set('Content-Type')
// ✅ Provide both required arguments
const headers = new Headers()
headers.set('Content-Type', 'application/json')

3. Incorrect argument combination with React hooks

React hooks like useReducer and useState have multiple overloads. Passing the wrong combination triggers TS2769.

import { useReducer } from 'react'
 
interface State {
  count: number
}
 
type Action = { type: 'increment' } | { type: 'decrement' }
 
function reducer(state: State, action: Action): State {
  switch (action.type) {
    case 'increment':
      return { count: state.count + 1 }
    case 'decrement':
      return { count: state.count - 1 }
  }
}
 
// ❌ Error: No overload matches this call. (TS2769)
// Missing the initial state argument
const [state, dispatch] = useReducer(reducer)
// ✅ Provide the required initial state
const [state, dispatch] = useReducer(reducer, { count: 0 })

4. Passing a union type where a specific type is needed

When a function has overloads for string and number separately, passing string | number may not match either overload.

function formatValue(value: string): string
function formatValue(value: number): string
function formatValue(value: string | number): string {
  return String(value)
}
 
const input: string | number = getUserInput()
 
// ❌ Error: No overload matches this call. (TS2769)
// string | number doesn't match string OR number individually
const result = formatValue(input)
// ✅ Narrow the type before calling
const input: string | number = getUserInput()
 
if (typeof input === 'string') {
  const result = formatValue(input) // matches the string overload
} else {
  const result = formatValue(input) // matches the number overload
}

How to Fix It

  1. Read the error carefully — TypeScript lists every overload it tried. Scroll through them and find the one that most closely matches what you intended. The sub-error under that overload tells you exactly what is wrong.

  2. Check your argument types — the most common fix is correcting a type mismatch. Hover over your arguments in your editor to see their inferred types, then compare with what the overload expects.

  3. Check argument count — make sure you are passing the right number of arguments. Some overloads require additional parameters that others do not.

  4. Narrow union types — if you are passing a union type (A | B) to a function that has separate overloads for A and B, narrow the value first using typeof, instanceof, or a type guard.

  5. Use explicit type parameters — for generic overloaded functions, you can sometimes resolve ambiguity by passing an explicit type argument:

// If TypeScript can't figure out which overload you want
const result = someFunction<string>(value)
  1. Check the library documentation — if the overloaded function comes from a library, check its docs for the correct call signature. The TypeScript error may be telling you that you are using the API incorrectly.

FAQ

What causes TypeScript error TS2769?

TS2769 occurs when you call a function with multiple overload signatures and none of them match the arguments you provided. Each overload defines a valid way to call the function — specific parameter types, counts, and combinations. If your arguments do not fit any of these declared patterns, TypeScript reports TS2769 along with details about why each overload was rejected.

How do I fix "no overload matches this call"?

Read the overload signatures listed in the error output to understand what argument combinations are valid. Then adjust your arguments to match one of those overloads. The most common fixes are: correcting a type mismatch on one of the arguments, adding a missing required argument, removing an extra argument, or narrowing a union type so it matches a specific overload.

How do I read overload error messages?

TypeScript's TS2769 error output can be long because it shows every overload it attempted. Each section starts with "Overload X of Y" followed by the signature and the reason it failed. Start from the overload that best matches your intended usage — typically the last one listed, since TypeScript considers it the closest match. Look for the Type 'X' is not assignable to type 'Y' line within that section to pinpoint the exact mismatch.

Related Errors

Related Concepts

Share this reference

Stay Updated

Get the latest TypeScript tips, tutorials, and course updates delivered straight to your inbox.

No spam, unsubscribe at any time.