Skip to content

Commit cff7874

Browse files
committed
Add tests
1 parent db840f4 commit cff7874

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

tests/cases/conformance/types/mapped/mappedTypesArraysTuples.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ type B = { b: string };
3030

3131
type T40 = Boxified<A | A[] | ReadonlyArray<A> | [A, B] | string | string[]>;
3232

33+
type ReadWrite<T> = { -readonly [P in keyof T] : T[P] };
34+
35+
type T50 = Readonly<string[]>;
36+
type T51 = Readonly<[number, number]>;
37+
type T52 = Partial<Readonly<string[]>>;
38+
type T53 = Readonly<Partial<string[]>>;
39+
type T54 = ReadWrite<Required<T53>>;
40+
3341
declare function unboxify<T>(x: Boxified<T>): T;
3442

3543
declare let x10: [Box<number>, Box<string>, ...Box<boolean>[]];
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// @strict: true
2+
3+
type T10 = string[];
4+
type T11 = Array<string>;
5+
type T12 = readonly string[];
6+
type T13 = ReadonlyArray<string>;
7+
8+
type T20 = [number, number];
9+
type T21 = readonly [number, number];
10+
11+
function f1(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) {
12+
ma = ra; // Error
13+
ma = mt;
14+
ma = rt; // Error
15+
ra = ma;
16+
ra = mt;
17+
ra = rt;
18+
mt = ma; // Error
19+
mt = ra; // Error
20+
mt = rt; // Error
21+
rt = ma; // Error
22+
rt = ra; // Error
23+
rt = mt;
24+
}

0 commit comments

Comments
 (0)