Skip to content

Commit 5ef7e9f

Browse files
committed
Accept new baselines
1 parent d869e56 commit 5ef7e9f

11 files changed

+1814
-303
lines changed
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
//// [genericRestParameters2.ts]
2+
declare const t1: [number, string, ...boolean[]];
3+
declare const t2: [string, ...boolean[]];
4+
declare const t3: [...boolean[]];
5+
declare const t4: [];
6+
7+
declare let f00: (...x: [number, string, boolean]) => void;
8+
declare let f01: (a: number, ...x: [string, boolean]) => void;
9+
declare let f02: (a: number, b: string, ...x: [boolean]) => void;
10+
declare let f03: (a: number, b: string, c: boolean) => void;
11+
declare let f04: (a: number, b: string, c: boolean, ...x: []) => void;
12+
13+
declare let f10: (...x: [number, string, ...boolean[]]) => void;
14+
declare let f11: (a: number, ...x: [string, ...boolean[]]) => void;
15+
declare let f12: (a: number, b: string, ...x: [...boolean[]]) => void;
16+
declare let f13: (a: number, b: string, ...c: boolean[]) => void;
17+
18+
declare const ns: [number, string];
19+
declare const sn: [string, number];
20+
21+
f10(42, "hello");
22+
f10(42, "hello", true);
23+
f10(42, "hello", true, false);
24+
f10(t1[0], t1[1], t1[2], t1[3]);
25+
f10(...t1);
26+
f10(42, ...t2);
27+
f10(42, "hello", ...t3);
28+
f10(42, "hello", true, ...t4);
29+
f10(42, "hello", true, ...t4, false, ...t3);
30+
31+
f11(42, "hello");
32+
f11(42, "hello", true);
33+
f11(42, "hello", true, false);
34+
f11(t1[0], t1[1], t1[2], t1[3]);
35+
f11(...t1);
36+
f11(42, ...t2);
37+
f11(42, "hello", ...t3);
38+
f11(42, "hello", true, ...t4);
39+
f11(42, "hello", true, ...t4, false, ...t3);
40+
41+
f12(42, "hello");
42+
f12(42, "hello", true);
43+
f12(42, "hello", true, false);
44+
f12(t1[0], t1[1], t1[2], t1[3]);
45+
f12(...t1);
46+
f12(42, ...t2);
47+
f12(42, "hello", ...t3);
48+
f12(42, "hello", true, ...t4);
49+
f12(42, "hello", true, ...t4, false, ...t3);
50+
51+
f13(42, "hello");
52+
f13(42, "hello", true);
53+
f13(42, "hello", true, false);
54+
f13(t1[0], t1[1], t1[2], t1[3]);
55+
f13(...t1);
56+
f13(42, ...t2);
57+
f13(42, "hello", ...t3);
58+
f13(42, "hello", true, ...t4);
59+
f13(42, "hello", true, ...t4, false, ...t3);
60+
61+
declare const f20: <T extends unknown[]>(...args: T) => T;
62+
63+
f20(...t1);
64+
f20(42, ...t2);
65+
f20(42, "hello", ...t3);
66+
f20(42, "hello", ...t2, true);
67+
68+
type Parameters<T extends Function> = T extends ((...args: infer U) => any) | (new(...args: infer U) => any) ? U : any[];
69+
70+
type T01 = Parameters<(x: number, y: string, ...z: boolean[]) => void>;
71+
type T02 = Parameters<(...args: [number, string, ...boolean[]]) => void>;
72+
type T03 = Parameters<new (x: number, y: string, ...z: boolean[]) => void>;
73+
type T04 = Parameters<new (...args: [number, string, ...boolean[]]) => void>;
74+
type T05<T extends any[]> = Parameters<(x: string, ...args: T) => void>;
75+
type T06 = T05<[number, ...boolean[]]>;
76+
77+
type P1<T extends Function> = T extends (head: infer A, ...tail: infer B) => any ? { head: A, tail: B } : any[];
78+
79+
type T10 = P1<(x: number, y: string, ...z: boolean[]) => void>;
80+
type T11 = P1<(...z: number[]) => void>;
81+
type T12 = P1<(x: number, y: number) => void>;
82+
83+
84+
//// [genericRestParameters2.js]
85+
"use strict";
86+
f10(42, "hello");
87+
f10(42, "hello", true);
88+
f10(42, "hello", true, false);
89+
f10(t1[0], t1[1], t1[2], t1[3]);
90+
f10.apply(void 0, t1);
91+
f10.apply(void 0, [42].concat(t2));
92+
f10.apply(void 0, [42, "hello"].concat(t3));
93+
f10.apply(void 0, [42, "hello", true].concat(t4));
94+
f10.apply(void 0, [42, "hello", true].concat(t4, [false], t3));
95+
f11(42, "hello");
96+
f11(42, "hello", true);
97+
f11(42, "hello", true, false);
98+
f11(t1[0], t1[1], t1[2], t1[3]);
99+
f11.apply(void 0, t1);
100+
f11.apply(void 0, [42].concat(t2));
101+
f11.apply(void 0, [42, "hello"].concat(t3));
102+
f11.apply(void 0, [42, "hello", true].concat(t4));
103+
f11.apply(void 0, [42, "hello", true].concat(t4, [false], t3));
104+
f12(42, "hello");
105+
f12(42, "hello", true);
106+
f12(42, "hello", true, false);
107+
f12(t1[0], t1[1], t1[2], t1[3]);
108+
f12.apply(void 0, t1);
109+
f12.apply(void 0, [42].concat(t2));
110+
f12.apply(void 0, [42, "hello"].concat(t3));
111+
f12.apply(void 0, [42, "hello", true].concat(t4));
112+
f12.apply(void 0, [42, "hello", true].concat(t4, [false], t3));
113+
f13(42, "hello");
114+
f13(42, "hello", true);
115+
f13(42, "hello", true, false);
116+
f13(t1[0], t1[1], t1[2], t1[3]);
117+
f13.apply(void 0, t1);
118+
f13.apply(void 0, [42].concat(t2));
119+
f13.apply(void 0, [42, "hello"].concat(t3));
120+
f13.apply(void 0, [42, "hello", true].concat(t4));
121+
f13.apply(void 0, [42, "hello", true].concat(t4, [false], t3));
122+
f20.apply(void 0, t1);
123+
f20.apply(void 0, [42].concat(t2));
124+
f20.apply(void 0, [42, "hello"].concat(t3));
125+
f20.apply(void 0, [42, "hello"].concat(t2, [true]));
126+
127+
128+
//// [genericRestParameters2.d.ts]
129+
declare const t1: [number, string, ...boolean[]];
130+
declare const t2: [string, ...boolean[]];
131+
declare const t3: [...boolean[]];
132+
declare const t4: [];
133+
declare let f00: (...x: [number, string, boolean]) => void;
134+
declare let f01: (a: number, ...x: [string, boolean]) => void;
135+
declare let f02: (a: number, b: string, ...x: [boolean]) => void;
136+
declare let f03: (a: number, b: string, c: boolean) => void;
137+
declare let f04: (a: number, b: string, c: boolean, ...x: []) => void;
138+
declare let f10: (...x: [number, string, ...boolean[]]) => void;
139+
declare let f11: (a: number, ...x: [string, ...boolean[]]) => void;
140+
declare let f12: (a: number, b: string, ...x: [...boolean[]]) => void;
141+
declare let f13: (a: number, b: string, ...c: boolean[]) => void;
142+
declare const ns: [number, string];
143+
declare const sn: [string, number];
144+
declare const f20: <T extends unknown[]>(...args: T) => T;
145+
declare type Parameters<T extends Function> = T extends ((...args: infer U) => any) | (new (...args: infer U) => any) ? U : any[];
146+
declare type T01 = Parameters<(x: number, y: string, ...z: boolean[]) => void>;
147+
declare type T02 = Parameters<(...args: [number, string, ...boolean[]]) => void>;
148+
declare type T03 = Parameters<new (x: number, y: string, ...z: boolean[]) => void>;
149+
declare type T04 = Parameters<new (...args: [number, string, ...boolean[]]) => void>;
150+
declare type T05<T extends any[]> = Parameters<(x: string, ...args: T) => void>;
151+
declare type T06 = T05<[number, ...boolean[]]>;
152+
declare type P1<T extends Function> = T extends (head: infer A, ...tail: infer B) => any ? {
153+
head: A;
154+
tail: B;
155+
} : any[];
156+
declare type T10 = P1<(x: number, y: string, ...z: boolean[]) => void>;
157+
declare type T11 = P1<(...z: number[]) => void>;
158+
declare type T12 = P1<(x: number, y: number) => void>;

0 commit comments

Comments
 (0)