You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
suggestion for improvement of the error message: No overload expects 2 arguments, but overloads do exist that expect either 2 or Infinity arguments. even if there is no definitions that take Infinity argumentsΒ #42418
declarefunctionfn(v1: number): void;declarefunctionfn(v1: number,v2: number): void;declarefunctionfn(v1: number,v2: number,v3: number): void;constarr=[0]fn(...arr,1,2)// No overload expects 2 arguments, but overloads do exist that expect either 2 or Infinity arguments. (2575)
π Actual behavior
The error message is
No overload expects 2 arguments, but overloads do exist that expect either 2 or Infinity arguments. (2575)
I understand this part: No overload expects 2 arguments because the first argument is potentially empty.
However, I do not define a function that takes Infinity arguments, though the error message tells so.
π Expected behavior
The error message should be something like
Expected 1-3 arguments, but got 2 or more.(2556)
since if I use fn like below, TypeScript says Expected 1-3 arguments, but got 1 or more.(2556)
Bug Report
π Search Terms
argument count error
π Version & Regression Information
overloadβ― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
The error message is
I understand this part:
No overload expects 2 argumentsbecause the first argument is potentially empty.However, I do not define a function that takes
Infinity arguments, though the error message tells so.π Expected behavior
The error message should be something like
since if I use
fnlike below, TypeScript saysExpected 1-3 arguments, but got 1 or more.(2556)