diff --git a/tests/cases/conformance/types/mapped/mappedTypesArraysTuples.ts b/tests/cases/conformance/types/mapped/mappedTypesArraysTuples.ts index 5d8fbc4b37..2c0f7433ea 100644 --- a/tests/cases/conformance/types/mapped/mappedTypesArraysTuples.ts +++ b/tests/cases/conformance/types/mapped/mappedTypesArraysTuples.ts @@ -30,6 +30,14 @@ type B = { b: string }; type T40 = Boxified | [A, B] | string | string[]>; +type ReadWrite = { -readonly [P in keyof T] : T[P] }; + +type T50 = Readonly; +type T51 = Readonly<[number, number]>; +type T52 = Partial>; +type T53 = Readonly>; +type T54 = ReadWrite>; + declare function unboxify(x: Boxified): T; declare let x10: [Box, Box, ...Box[]]; diff --git a/tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts b/tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts new file mode 100644 index 0000000000..92179edc04 --- /dev/null +++ b/tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts @@ -0,0 +1,24 @@ +// @strict: true + +type T10 = string[]; +type T11 = Array; +type T12 = readonly string[]; +type T13 = ReadonlyArray; + +type T20 = [number, number]; +type T21 = readonly [number, number]; + +function f1(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) { + ma = ra; // Error + ma = mt; + ma = rt; // Error + ra = ma; + ra = mt; + ra = rt; + mt = ma; // Error + mt = ra; // Error + mt = rt; // Error + rt = ma; // Error + rt = ra; // Error + rt = mt; +}