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
Copy file name to clipboardExpand all lines: tests/baselines/reference/variadicTuples1.errors.txt
+76-2
Original file line number
Diff line number
Diff line change
@@ -20,10 +20,29 @@ tests/cases/conformance/types/tuple/variadicTuples1.ts(169,5): error TS2322: Typ
20
20
tests/cases/conformance/types/tuple/variadicTuples1.ts(170,5): error TS2322: Type 'T' is not assignable to type '[...T]'.
21
21
The type 'readonly unknown[]' is 'readonly' and cannot be assigned to the mutable type '[...T]'.
22
22
tests/cases/conformance/types/tuple/variadicTuples1.ts(171,5): error TS4104: The type 'readonly [...T]' is 'readonly' and cannot be assigned to the mutable type '[...T]'.
23
-
tests/cases/conformance/types/tuple/variadicTuples1.ts(303,14): error TS7019: Rest parameter 'x' implicitly has an 'any[]' type.
23
+
tests/cases/conformance/types/tuple/variadicTuples1.ts(181,5): error TS2322: Type 'T' is not assignable to type '[...U]'.
24
+
Type 'string[]' is not assignable to type '[...U]'.
25
+
Target requires 1 element(s) but source may have fewer.
26
+
tests/cases/conformance/types/tuple/variadicTuples1.ts(182,5): error TS2322: Type '[...T]' is not assignable to type '[...U]'.
27
+
Type 'T' is not assignable to type 'U'.
28
+
'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'string[]'.
29
+
Type 'string[]' is not assignable to type 'U'.
30
+
'U' could be instantiated with an arbitrary type which could be unrelated to 'string[]'.
31
+
tests/cases/conformance/types/tuple/variadicTuples1.ts(188,5): error TS2322: Type 'T' is not assignable to type '[...T]'.
32
+
The type 'readonly string[]' is 'readonly' and cannot be assigned to the mutable type '[...T]'.
33
+
tests/cases/conformance/types/tuple/variadicTuples1.ts(190,5): error TS2322: Type 'T' is not assignable to type '[...U]'.
34
+
The type 'readonly string[]' is 'readonly' and cannot be assigned to the mutable type '[...U]'.
35
+
tests/cases/conformance/types/tuple/variadicTuples1.ts(191,5): error TS2322: Type '[...T]' is not assignable to type '[...U]'.
36
+
Type 'T' is not assignable to type 'U'.
37
+
'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'readonly string[]'.
38
+
Type 'readonly string[]' is not assignable to type 'U'.
39
+
'U' could be instantiated with an arbitrary type which could be unrelated to 'readonly string[]'.
40
+
tests/cases/conformance/types/tuple/variadicTuples1.ts(203,5): error TS2322: Type 'string' is not assignable to type 'keyof [1, 2, ...T]'.
@@ -234,6 +253,61 @@ tests/cases/conformance/types/tuple/variadicTuples1.ts(303,14): error TS7019: Re
234
253
r = m;
235
254
}
236
255
256
+
function f13<T extends string[], U extends T>(t0: T, t1: [...T], t2: [...U]) {
257
+
t0 = t1;
258
+
t0 = t2;
259
+
t1 = t0;
260
+
t1 = t2;
261
+
t2 = t0; // Error
262
+
~~
263
+
!!! error TS2322: Type 'T' is not assignable to type '[...U]'.
264
+
!!! error TS2322: Type 'string[]' is not assignable to type '[...U]'.
265
+
!!! error TS2322: Target requires 1 element(s) but source may have fewer.
266
+
t2 = t1; // Error
267
+
~~
268
+
!!! error TS2322: Type '[...T]' is not assignable to type '[...U]'.
269
+
!!! error TS2322: Type 'T' is not assignable to type 'U'.
270
+
!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'string[]'.
271
+
!!! error TS2322: Type 'string[]' is not assignable to type 'U'.
272
+
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'string[]'.
273
+
}
274
+
275
+
function f14<T extends readonly string[], U extends T>(t0: T, t1: [...T], t2: [...U]) {
276
+
t0 = t1;
277
+
t0 = t2;
278
+
t1 = t0; // Error
279
+
~~
280
+
!!! error TS2322: Type 'T' is not assignable to type '[...T]'.
281
+
!!! error TS2322: The type 'readonly string[]' is 'readonly' and cannot be assigned to the mutable type '[...T]'.
282
+
t1 = t2;
283
+
t2 = t0; // Error
284
+
~~
285
+
!!! error TS2322: Type 'T' is not assignable to type '[...U]'.
286
+
!!! error TS2322: The type 'readonly string[]' is 'readonly' and cannot be assigned to the mutable type '[...U]'.
287
+
t2 = t1; // Error
288
+
~~
289
+
!!! error TS2322: Type '[...T]' is not assignable to type '[...U]'.
290
+
!!! error TS2322: Type 'T' is not assignable to type 'U'.
291
+
!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'readonly string[]'.
292
+
!!! error TS2322: Type 'readonly string[]' is not assignable to type 'U'.
293
+
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'readonly string[]'.
0 commit comments