Skip to content

    ↑↓ move · ⏎ open · esc close

    TS2769

    No overload matches

    No overload matches this call.

    The compiler’s own words. Not translated — this is the string you pasted into a search box.

    The function has several signatures and the arguments fit none of them. The compiler then reports every attempt, which is why this error is so long.

    Reproduction

    declare function f(a: string): void
    declare function f(a: number): void
    
    f(true)

    The build asserts this emits exactly this code.

    Why the compiler says this

    Overload resolution tries each signature in declaration order and stops at the first that fits. When none does, there is no single "right" error to report, so it reports the failure of each candidate in turn. The useful part is almost never the first line: it is the list underneath, where one candidate usually failed for a much smaller reason than the others.

    Fixes

    1. 01
      declare function f(a: string): void
      declare function f(a: number): void
      
      f('true')

      Match one of them. Find the candidate in the list whose complaint is smallest and satisfy that one.

    2. 02
      declare function f(a: string): void
      declare function f(a: number): void
      declare function f(a: boolean): void
      
      f(true)

      Or add the overload that was missing, if the function should support this shape. Overloads are a list of intended uses; a new use means a new entry.

    Takeaway

    Read overload errors bottom-up. The last candidate is usually the one you meant, and its complaint is the one worth fixing.

    Errors