/
readonlyArraysAndTuples.errors.txt
64 lines (58 loc) · 4.02 KB
/
readonlyArraysAndTuples.errors.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(9,12): error TS1354: 'readonly' type modifier is only permitted on array and tuple literal types.
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(10,15): error TS1354: 'readonly' type modifier is only permitted on array and tuple literal types.
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(11,12): error TS1354: 'readonly' type modifier is only permitted on array and tuple literal types.
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(12,12): error TS1354: 'readonly' type modifier is only permitted on array and tuple literal types.
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(15,5): error TS4104: A 'ReadonlyArray' cannot be assigned to an 'Array' because 'Array's can be mutated.
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(17,5): error TS4105: A 'readonly' tuple cannot be assigned to a mutable array-like type.
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(21,5): error TS2739: Type 'string[]' is missing the following properties from type '[string, string]': 0, 1
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(22,5): error TS2740: Type 'readonly string[]' is missing the following properties from type '[string, string]': 0, 1, pop, push, and 5 more.
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(23,5): error TS4105: A 'readonly' tuple cannot be assigned to a mutable array-like type.
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(24,5): error TS2739: Type 'string[]' is missing the following properties from type 'readonly [string, string]': 0, 1
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(25,5): error TS2739: Type 'readonly string[]' is missing the following properties from type 'readonly [string, string]': 0, 1
==== tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts (11 errors) ====
type T10 = string[];
type T11 = Array<string>;
type T12 = readonly string[];
type T13 = ReadonlyArray<string>;
type T20 = [number, number];
type T21 = readonly [number, number];
type T30 = readonly string; // Error
~~~~~~~~
!!! error TS1354: 'readonly' type modifier is only permitted on array and tuple literal types.
type T31<T> = readonly T; // Error
~~~~~~~~
!!! error TS1354: 'readonly' type modifier is only permitted on array and tuple literal types.
type T32 = readonly readonly string[]; // Error
~~~~~~~~
!!! error TS1354: 'readonly' type modifier is only permitted on array and tuple literal types.
type T33 = readonly Array<string>; // Error
~~~~~~~~
!!! error TS1354: 'readonly' type modifier is only permitted on array and tuple literal types.
function f1(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) {
ma = ra; // Error
~~
!!! error TS4104: A 'ReadonlyArray' cannot be assigned to an 'Array' because 'Array's can be mutated.
ma = mt;
ma = rt; // Error
~~
!!! error TS4105: A 'readonly' tuple cannot be assigned to a mutable array-like type.
ra = ma;
ra = mt;
ra = rt;
mt = ma; // Error
~~
!!! error TS2739: Type 'string[]' is missing the following properties from type '[string, string]': 0, 1
mt = ra; // Error
~~
!!! error TS2740: Type 'readonly string[]' is missing the following properties from type '[string, string]': 0, 1, pop, push, and 5 more.
mt = rt; // Error
~~
!!! error TS4105: A 'readonly' tuple cannot be assigned to a mutable array-like type.
rt = ma; // Error
~~
!!! error TS2739: Type 'string[]' is missing the following properties from type 'readonly [string, string]': 0, 1
rt = ra; // Error
~~
!!! error TS2739: Type 'readonly string[]' is missing the following properties from type 'readonly [string, string]': 0, 1
rt = mt;
}