Improve error message for overload that takes spread arguments

The original error message on the last line I have added to in
functionParameterArityMismatch.ts was

    No overload expects 5 arguments, but overloads do exist that expect
    either 4 or Infinity arguments.

even if we do not define a function that takes Infinity arguments.

This PR changes it to this:

    Expected 0-6 arguments, but got 5 or more.

I feel it is still a bit strange but much more understandable.

Fixes #42418
This commit is contained in:
Masato Urai
2021-01-26 19:54:36 +09:00
committed by Eli Barzilay
parent 4fc9c8446d
commit a3ead92046
6 changed files with 32 additions and 4 deletions

View File

@@ -12,3 +12,4 @@ f2(1);
f2(1, 2, 3);
f2(1, 2, 3, 4, 5);
f2(1, 2, 3, 4, 5, 6, 7);
f2(...[1], 2, 3, 4, 5, 6);