Skip to content

Commit a7ca7f4

Browse files
committed
Accept new baselines
1 parent cff7874 commit a7ca7f4

7 files changed

+457
-139
lines changed

tests/baselines/reference/mappedTypesArraysTuples.js

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

2929
type T40 = Boxified<A | A[] | ReadonlyArray<A> | [A, B] | string | string[]>;
3030

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

3341
declare let x10: [Box<number>, Box<string>, ...Box<boolean>[]];
@@ -147,6 +155,14 @@ declare type B = {
147155
b: string;
148156
};
149157
declare type T40 = Boxified<A | A[] | ReadonlyArray<A> | [A, B] | string | string[]>;
158+
declare type ReadWrite<T> = {
159+
-readonly [P in keyof T]: T[P];
160+
};
161+
declare type T50 = Readonly<string[]>;
162+
declare type T51 = Readonly<[number, number]>;
163+
declare type T52 = Partial<Readonly<string[]>>;
164+
declare type T53 = Readonly<Partial<string[]>>;
165+
declare type T54 = ReadWrite<Required<T53>>;
150166
declare function unboxify<T>(x: Boxified<T>): T;
151167
declare let x10: [Box<number>, Box<string>, ...Box<boolean>[]];
152168
declare let y10: [number, string, ...boolean[]];

tests/baselines/reference/mappedTypesArraysTuples.symbols

Lines changed: 171 additions & 139 deletions
Large diffs are not rendered by default.

tests/baselines/reference/mappedTypesArraysTuples.types

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,24 @@ type B = { b: string };
6868
type T40 = Boxified<A | A[] | ReadonlyArray<A> | [A, B] | string | string[]>;
6969
>T40 : string | Box<string>[] | Boxified<A> | Box<A>[] | readonly Box<A>[] | [Box<A>, Box<B>]
7070

71+
type ReadWrite<T> = { -readonly [P in keyof T] : T[P] };
72+
>ReadWrite : ReadWrite<T>
73+
74+
type T50 = Readonly<string[]>;
75+
>T50 : readonly string[]
76+
77+
type T51 = Readonly<[number, number]>;
78+
>T51 : readonly [number, number]
79+
80+
type T52 = Partial<Readonly<string[]>>;
81+
>T52 : readonly (string | undefined)[]
82+
83+
type T53 = Readonly<Partial<string[]>>;
84+
>T53 : readonly (string | undefined)[]
85+
86+
type T54 = ReadWrite<Required<T53>>;
87+
>T54 : string[]
88+
7189
declare function unboxify<T>(x: Boxified<T>): T;
7290
>unboxify : <T>(x: Boxified<T>) => T
7391
>x : Boxified<T>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(10,5): error TS2740: Type 'readonly string[]' is missing the following properties from type 'string[]': pop, push, reverse, shift, and 3 more.
2+
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(12,5): error TS2740: Type 'readonly [string, string]' is missing the following properties from type 'string[]': pop, push, reverse, shift, and 3 more.
3+
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(16,5): error TS2739: Type 'string[]' is missing the following properties from type '[string, string]': 0, 1
4+
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(17,5): error TS2740: Type 'readonly string[]' is missing the following properties from type '[string, string]': 0, 1, pop, push, and 5 more.
5+
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(18,5): error TS2740: Type 'readonly [string, string]' is missing the following properties from type '[string, string]': pop, push, reverse, shift, and 3 more.
6+
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(19,5): error TS2739: Type 'string[]' is missing the following properties from type 'readonly [string, string]': 0, 1
7+
tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(20,5): error TS2739: Type 'readonly string[]' is missing the following properties from type 'readonly [string, string]': 0, 1
8+
9+
10+
==== tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts (7 errors) ====
11+
type T10 = string[];
12+
type T11 = Array<string>;
13+
type T12 = readonly string[];
14+
type T13 = ReadonlyArray<string>;
15+
16+
type T20 = [number, number];
17+
type T21 = readonly [number, number];
18+
19+
function f1(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) {
20+
ma = ra; // Error
21+
~~
22+
!!! error TS2740: Type 'readonly string[]' is missing the following properties from type 'string[]': pop, push, reverse, shift, and 3 more.
23+
ma = mt;
24+
ma = rt; // Error
25+
~~
26+
!!! error TS2740: Type 'readonly [string, string]' is missing the following properties from type 'string[]': pop, push, reverse, shift, and 3 more.
27+
ra = ma;
28+
ra = mt;
29+
ra = rt;
30+
mt = ma; // Error
31+
~~
32+
!!! error TS2739: Type 'string[]' is missing the following properties from type '[string, string]': 0, 1
33+
mt = ra; // Error
34+
~~
35+
!!! error TS2740: Type 'readonly string[]' is missing the following properties from type '[string, string]': 0, 1, pop, push, and 5 more.
36+
mt = rt; // Error
37+
~~
38+
!!! error TS2740: Type 'readonly [string, string]' is missing the following properties from type '[string, string]': pop, push, reverse, shift, and 3 more.
39+
rt = ma; // Error
40+
~~
41+
!!! error TS2739: Type 'string[]' is missing the following properties from type 'readonly [string, string]': 0, 1
42+
rt = ra; // Error
43+
~~
44+
!!! error TS2739: Type 'readonly string[]' is missing the following properties from type 'readonly [string, string]': 0, 1
45+
rt = mt;
46+
}
47+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//// [readonlyArraysAndTuples.ts]
2+
type T10 = string[];
3+
type T11 = Array<string>;
4+
type T12 = readonly string[];
5+
type T13 = ReadonlyArray<string>;
6+
7+
type T20 = [number, number];
8+
type T21 = readonly [number, number];
9+
10+
function f1(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) {
11+
ma = ra; // Error
12+
ma = mt;
13+
ma = rt; // Error
14+
ra = ma;
15+
ra = mt;
16+
ra = rt;
17+
mt = ma; // Error
18+
mt = ra; // Error
19+
mt = rt; // Error
20+
rt = ma; // Error
21+
rt = ra; // Error
22+
rt = mt;
23+
}
24+
25+
26+
//// [readonlyArraysAndTuples.js]
27+
"use strict";
28+
function f1(ma, ra, mt, rt) {
29+
ma = ra; // Error
30+
ma = mt;
31+
ma = rt; // Error
32+
ra = ma;
33+
ra = mt;
34+
ra = rt;
35+
mt = ma; // Error
36+
mt = ra; // Error
37+
mt = rt; // Error
38+
rt = ma; // Error
39+
rt = ra; // Error
40+
rt = mt;
41+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
=== tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts ===
2+
type T10 = string[];
3+
>T10 : Symbol(T10, Decl(readonlyArraysAndTuples.ts, 0, 0))
4+
5+
type T11 = Array<string>;
6+
>T11 : Symbol(T11, Decl(readonlyArraysAndTuples.ts, 0, 20))
7+
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
8+
9+
type T12 = readonly string[];
10+
>T12 : Symbol(T12, Decl(readonlyArraysAndTuples.ts, 1, 25))
11+
12+
type T13 = ReadonlyArray<string>;
13+
>T13 : Symbol(T13, Decl(readonlyArraysAndTuples.ts, 2, 29))
14+
>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --))
15+
16+
type T20 = [number, number];
17+
>T20 : Symbol(T20, Decl(readonlyArraysAndTuples.ts, 3, 33))
18+
19+
type T21 = readonly [number, number];
20+
>T21 : Symbol(T21, Decl(readonlyArraysAndTuples.ts, 5, 28))
21+
22+
function f1(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) {
23+
>f1 : Symbol(f1, Decl(readonlyArraysAndTuples.ts, 6, 37))
24+
>ma : Symbol(ma, Decl(readonlyArraysAndTuples.ts, 8, 12))
25+
>ra : Symbol(ra, Decl(readonlyArraysAndTuples.ts, 8, 25))
26+
>mt : Symbol(mt, Decl(readonlyArraysAndTuples.ts, 8, 48))
27+
>rt : Symbol(rt, Decl(readonlyArraysAndTuples.ts, 8, 70))
28+
29+
ma = ra; // Error
30+
>ma : Symbol(ma, Decl(readonlyArraysAndTuples.ts, 8, 12))
31+
>ra : Symbol(ra, Decl(readonlyArraysAndTuples.ts, 8, 25))
32+
33+
ma = mt;
34+
>ma : Symbol(ma, Decl(readonlyArraysAndTuples.ts, 8, 12))
35+
>mt : Symbol(mt, Decl(readonlyArraysAndTuples.ts, 8, 48))
36+
37+
ma = rt; // Error
38+
>ma : Symbol(ma, Decl(readonlyArraysAndTuples.ts, 8, 12))
39+
>rt : Symbol(rt, Decl(readonlyArraysAndTuples.ts, 8, 70))
40+
41+
ra = ma;
42+
>ra : Symbol(ra, Decl(readonlyArraysAndTuples.ts, 8, 25))
43+
>ma : Symbol(ma, Decl(readonlyArraysAndTuples.ts, 8, 12))
44+
45+
ra = mt;
46+
>ra : Symbol(ra, Decl(readonlyArraysAndTuples.ts, 8, 25))
47+
>mt : Symbol(mt, Decl(readonlyArraysAndTuples.ts, 8, 48))
48+
49+
ra = rt;
50+
>ra : Symbol(ra, Decl(readonlyArraysAndTuples.ts, 8, 25))
51+
>rt : Symbol(rt, Decl(readonlyArraysAndTuples.ts, 8, 70))
52+
53+
mt = ma; // Error
54+
>mt : Symbol(mt, Decl(readonlyArraysAndTuples.ts, 8, 48))
55+
>ma : Symbol(ma, Decl(readonlyArraysAndTuples.ts, 8, 12))
56+
57+
mt = ra; // Error
58+
>mt : Symbol(mt, Decl(readonlyArraysAndTuples.ts, 8, 48))
59+
>ra : Symbol(ra, Decl(readonlyArraysAndTuples.ts, 8, 25))
60+
61+
mt = rt; // Error
62+
>mt : Symbol(mt, Decl(readonlyArraysAndTuples.ts, 8, 48))
63+
>rt : Symbol(rt, Decl(readonlyArraysAndTuples.ts, 8, 70))
64+
65+
rt = ma; // Error
66+
>rt : Symbol(rt, Decl(readonlyArraysAndTuples.ts, 8, 70))
67+
>ma : Symbol(ma, Decl(readonlyArraysAndTuples.ts, 8, 12))
68+
69+
rt = ra; // Error
70+
>rt : Symbol(rt, Decl(readonlyArraysAndTuples.ts, 8, 70))
71+
>ra : Symbol(ra, Decl(readonlyArraysAndTuples.ts, 8, 25))
72+
73+
rt = mt;
74+
>rt : Symbol(rt, Decl(readonlyArraysAndTuples.ts, 8, 70))
75+
>mt : Symbol(mt, Decl(readonlyArraysAndTuples.ts, 8, 48))
76+
}
77+
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
=== tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts ===
2+
type T10 = string[];
3+
>T10 : string[]
4+
5+
type T11 = Array<string>;
6+
>T11 : string[]
7+
8+
type T12 = readonly string[];
9+
>T12 : readonly string[]
10+
11+
type T13 = ReadonlyArray<string>;
12+
>T13 : readonly string[]
13+
14+
type T20 = [number, number];
15+
>T20 : [number, number]
16+
17+
type T21 = readonly [number, number];
18+
>T21 : readonly [number, number]
19+
20+
function f1(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) {
21+
>f1 : (ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) => void
22+
>ma : string[]
23+
>ra : readonly string[]
24+
>mt : [string, string]
25+
>rt : readonly [string, string]
26+
27+
ma = ra; // Error
28+
>ma = ra : readonly string[]
29+
>ma : string[]
30+
>ra : readonly string[]
31+
32+
ma = mt;
33+
>ma = mt : [string, string]
34+
>ma : string[]
35+
>mt : [string, string]
36+
37+
ma = rt; // Error
38+
>ma = rt : readonly [string, string]
39+
>ma : string[]
40+
>rt : readonly [string, string]
41+
42+
ra = ma;
43+
>ra = ma : string[]
44+
>ra : readonly string[]
45+
>ma : string[]
46+
47+
ra = mt;
48+
>ra = mt : [string, string]
49+
>ra : readonly string[]
50+
>mt : [string, string]
51+
52+
ra = rt;
53+
>ra = rt : readonly [string, string]
54+
>ra : readonly string[]
55+
>rt : readonly [string, string]
56+
57+
mt = ma; // Error
58+
>mt = ma : string[]
59+
>mt : [string, string]
60+
>ma : string[]
61+
62+
mt = ra; // Error
63+
>mt = ra : readonly string[]
64+
>mt : [string, string]
65+
>ra : readonly string[]
66+
67+
mt = rt; // Error
68+
>mt = rt : readonly [string, string]
69+
>mt : [string, string]
70+
>rt : readonly [string, string]
71+
72+
rt = ma; // Error
73+
>rt = ma : string[]
74+
>rt : readonly [string, string]
75+
>ma : string[]
76+
77+
rt = ra; // Error
78+
>rt = ra : readonly string[]
79+
>rt : readonly [string, string]
80+
>ra : readonly string[]
81+
82+
rt = mt;
83+
>rt = mt : [string, string]
84+
>rt : readonly [string, string]
85+
>mt : [string, string]
86+
}
87+

0 commit comments

Comments
 (0)