Skip to content

Commit e5d520e

Browse files
committed
Add tests
1 parent bf99b8e commit e5d520e

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// @strict: true
2+
// @declaration: true
3+
4+
declare const t1: [number, boolean, string];
5+
6+
(function (a, b, c){})(...t1);
7+
(function (...x){})(...t1);
8+
(function (a, ...x){})(...t1);
9+
(function (a, b, ...x){})(...t1);
10+
(function (a, b, c, ...x){})(...t1);
11+
12+
declare function f1(cb: (...args: typeof t1) => void): void;
13+
14+
f1((a, b, c) => {})
15+
f1((...x) => {})
16+
f1((a, ...x) => {})
17+
f1((a, b, ...x) => {})
18+
f1((a, b, c, ...x) => {})
19+
20+
declare const t2: [number, boolean, ...string[]];
21+
22+
(function (a, b, c){})(...t2);
23+
(function (...x){})(...t2);
24+
(function (a, ...x){})(...t2);
25+
(function (a, b, ...x){})(...t2);
26+
(function (a, b, c, ...x){})(...t2);
27+
28+
declare function f2(cb: (...args: typeof t2) => void): void;
29+
30+
f2((a, b, c) => {})
31+
f2((...x) => {})
32+
f2((a, ...x) => {})
33+
f2((a, b, ...x) => {})
34+
f2((a, b, c, ...x) => {})
35+
36+
declare const t3: [boolean, ...string[]];
37+
38+
(function (a, b, c){})(1, ...t3);
39+
(function (...x){})(1, ...t3);
40+
(function (a, ...x){})(1, ...t3);
41+
(function (a, b, ...x){})(1, ...t3);
42+
(function (a, b, c, ...x){})(1, ...t3);
43+
44+
declare function f3(cb: (x: number, ...args: typeof t3) => void): void;
45+
46+
f3((a, b, c) => {})
47+
f3((...x) => {})
48+
f3((a, ...x) => {})
49+
f3((a, b, ...x) => {})
50+
f3((a, b, c, ...x) => {})
51+
52+
function f4<T extends any[]>(t: T) {
53+
(function(...x){})(...t);
54+
(function(a, ...x){})(1, ...t);
55+
(function(a, ...x){})(1, 2, ...t);
56+
function f(cb: (x: number, ...args: T) => void) {}
57+
f((...x) => {});
58+
f((a, ...x) => {});
59+
f((a, b, ...x) => {});
60+
}
61+
62+
// Repro from #25288
63+
64+
declare var tuple: [number, string];
65+
(function foo(a, b){}(...tuple));
66+
67+
// Repro from #25289
68+
69+
declare function take(cb: (a: number, b: string) => void): void;
70+
71+
(function foo(...rest){}(1, ''));
72+
take(function(...rest){});

0 commit comments

Comments
 (0)