Skip to content
TS2554

    ↑↓ move · ⏎ open · esc close

    TS2554

    Wrong number of arguments

    Expected 2 arguments, but got 1.

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

    The selected call signature requires more arguments than this call supplies.

    Reproduction

    function pair(a: string, b: number) {}
    
    pair('x')

    The build asserts this emits exactly this code.

    Why the compiler says this

    A required parameter is part of the function contract. Omitting it would make the implementation receive `undefined` even though its type says that cannot happen, so the call is rejected before it can break that promise.

    Fixes

    1. 01
      function pair(a: string, b: number) {}
      
      pair('x', 1)

      Supply every required argument when the function genuinely needs both.

    2. 02
      function pair(a: string, b = 0) {}
      
      pair('x')

      Give the parameter a default when omission has a meaningful, safe interpretation.

    Takeaway

    Fix the caller when the input is required; change the signature only when the operation truly supports omission.

    Where to go next

    Errors