TypeScript/tests/cases/conformance/expressions/functionCalls/callWithSpread3.ts
Collins Abitekaniza 7b55d1846b Giving too many arguments should error on the first argument that exceeds arity (#27982)
* span on first arg that exceeds arity

* refactor baseline

* handle cases for spread arguments

* refactor + add coverage for tuple spread cases

* create diagnostic on NodeArray of exceeding args

* test function overloading
2019-03-12 15:57:12 -07:00

10 lines
No EOL
425 B
TypeScript

declare function takeTwo(a: string, b: string): void;
declare const t2: [string, string];
declare const t3: [string, string, string];
takeTwo('a', ...t2); // error on ...t2
takeTwo('a', 'b', 'c', ...t2); // error on 'c' and ...t2
takeTwo('a', 'b', ...t2, 'c'); // error on ...t2 and 'c'
takeTwo('a', 'b', 'c', ...t2, 'd'); // error on 'c', ...t2 and 'd'
takeTwo(...t2, 'a'); // error on 'a'
takeTwo(...t3); // error on ...t3