You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,6): error TS2322: Type 'string' is not assignable to type 'number'.
25
25
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9): error TS2322: Type 'number' is not assignable to type 'string'.
26
-
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(158,16): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'number[]', but here has type '[number, number]'.
27
-
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(159,19): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'number[]', but here has type '[number]'.
28
-
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(160,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'a3' must be of type 'any[]', but here has type '[]'.
29
-
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(176,16): error TS2403: Subsequent variable declarations must have the same type. Variable 'a1' must be of type '(string | boolean)[]', but here has type '[string, boolean]'.
30
-
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(177,19): error TS2403: Subsequent variable declarations must have the same type. Variable 'a2' must be of type 'boolean[]', but here has type '[boolean]'.
31
-
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(178,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'a3' must be of type 'any[]', but here has type '[]'.
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'number[]', but here has type '[number, number]'.
242
-
var [x, y, ...a] = [1, 2, 3];
243
-
~
244
-
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'number[]', but here has type '[number]'.
245
-
var [x, y, z, ...a3] = [1, 2, 3];
246
-
~~
247
-
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a3' must be of type 'any[]', but here has type '[]'.
248
-
[...a] = [1, 2, 3];
249
-
[x, ...a] = [1, 2, 3];
250
-
[x, y, ...a] = [1, 2, 3];
251
-
[x, y, z, ...a3] = [1, 2, 3];
230
+
var a0: [];
231
+
var a1: [number];
232
+
var a2: [number, number];
233
+
var a3: [number, number, number];
234
+
var [...a3] = v;
235
+
var [x, ...a2] = v;
236
+
var [x, y, ...a1] = v;
237
+
var [x, y, z, ...a0] = v;
238
+
[...a3] = v;
239
+
[x, ...a2] = v;
240
+
[x, y, ...a1] = v;
241
+
[x, y, z, ...a0] = v;
252
242
}
253
243
254
-
function f21() {
244
+
function f21(v: [number, string, boolean]) {
255
245
var x: number;
256
246
var y: string;
257
247
var z: boolean;
258
-
var a0: (number | string | boolean)[];
259
-
var a1: (string | boolean)[];
260
-
var a2: boolean[];
261
-
var a3: any[];
262
-
var [...a0] = [1, "hello", true];
263
-
var [x, ...a1] = [1, "hello", true];
264
-
~~
265
-
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a1' must be of type '(string | boolean)[]', but here has type '[string, boolean]'.
266
-
var [x, y, ...a2] = [1, "hello", true];
267
-
~~
268
-
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a2' must be of type 'boolean[]', but here has type '[boolean]'.
269
-
var [x, y, z, ...a3] = [1, "hello", true];
270
-
~~
271
-
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a3' must be of type 'any[]', but here has type '[]'.
0 commit comments