TypeScript/tests/baselines/reference/callWithSpread3.types
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

61 lines
1.5 KiB
Plaintext

=== tests/cases/conformance/expressions/functionCalls/callWithSpread3.ts ===
declare function takeTwo(a: string, b: string): void;
>takeTwo : (a: string, b: string) => void
>a : string
>b : string
declare const t2: [string, string];
>t2 : [string, string]
declare const t3: [string, string, string];
>t3 : [string, string, string]
takeTwo('a', ...t2); // error on ...t2
>takeTwo('a', ...t2) : void
>takeTwo : (a: string, b: string) => void
>'a' : "a"
>...t2 : string
>t2 : [string, string]
takeTwo('a', 'b', 'c', ...t2); // error on 'c' and ...t2
>takeTwo('a', 'b', 'c', ...t2) : void
>takeTwo : (a: string, b: string) => void
>'a' : "a"
>'b' : "b"
>'c' : "c"
>...t2 : string
>t2 : [string, string]
takeTwo('a', 'b', ...t2, 'c'); // error on ...t2 and 'c'
>takeTwo('a', 'b', ...t2, 'c') : void
>takeTwo : (a: string, b: string) => void
>'a' : "a"
>'b' : "b"
>...t2 : string
>t2 : [string, string]
>'c' : "c"
takeTwo('a', 'b', 'c', ...t2, 'd'); // error on 'c', ...t2 and 'd'
>takeTwo('a', 'b', 'c', ...t2, 'd') : void
>takeTwo : (a: string, b: string) => void
>'a' : "a"
>'b' : "b"
>'c' : "c"
>...t2 : string
>t2 : [string, string]
>'d' : "d"
takeTwo(...t2, 'a'); // error on 'a'
>takeTwo(...t2, 'a') : void
>takeTwo : (a: string, b: string) => void
>...t2 : string
>t2 : [string, string]
>'a' : "a"
takeTwo(...t3); // error on ...t3
>takeTwo(...t3) : void
>takeTwo : (a: string, b: string) => void
>...t3 : string
>t3 : [string, string, string]