typescript type_error ai_generated true

error TS2769: No overload matches this call

ID: typescript/ts2769-no-overload-matches

Also available as: JSON · Markdown
88%Fix Rate
90%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
5 active

Root Cause

None of the function's overload signatures match the provided arguments. Check each overload's requirements.

generic

Workarounds

  1. 92% success Read each overload signature in the error — match your args to one of them
    // Read the error carefully — it lists each overload:
    // Overload 1 of 3: (a: string, b: number) => void
    // Overload 2 of 3: (a: number) => void
    // Overload 3 of 3: (a: Config) => void
    
    // Match your arguments to one of them:
    myFunction('hello', 42);  // matches overload 1
    myFunction(42);            // matches overload 2

    Sources: https://www.typescriptlang.org/docs/handbook/2/functions.html#function-overloads

  2. 88% success Check for subtle type differences: string vs String, number vs bigint
    string vs String, number vs bigint

    Sources: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html

  3. 85% success Common with event handlers: use the specific event type, not generic Event
    onClick: (e: React.MouseEvent<HTMLButtonElement>) => void

    Sources: https://www.typescriptlang.org/docs/handbook/2/functions.html

Dead Ends

Common approaches that don't work:

  1. Cast arguments to any 80% fail

    Bypasses type checking entirely — the overloads exist for correctness

  2. Remove the overload signatures 85% fail

    If it's a library function, you can't modify it

Error Chain

Leads to:
Preceded by:
Frequently confused with: