Skip to content

Commit 00f7d85

Browse files
committed
Accept new baselines
1 parent 7e974fa commit 00f7d85

File tree

3 files changed

+385
-409
lines changed

3 files changed

+385
-409
lines changed
Lines changed: 50 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,145 +1,121 @@
11
//// [mappedTypeModifiers.ts]
22

33
type T = { a: number, b: string };
4-
type TU = { a: number | undefined, b: string | undefined };
54
type TP = { a?: number, b?: string };
65
type TR = { readonly a: number, readonly b: string };
76
type TPR = { readonly a?: number, readonly b?: string };
87

9-
// Validate they all have the same keys
108
var v00: "a" | "b";
119
var v00: keyof T;
12-
var v00: keyof TU;
1310
var v00: keyof TP;
1411
var v00: keyof TR;
1512
var v00: keyof TPR;
1613

17-
// Validate that non-isomorphic mapped types strip modifiers
1814
var v01: T;
19-
var v01: Pick<TR, keyof T>;
20-
var v01: Pick<Readonly<T>, keyof T>;
15+
var v01: { [P in keyof T]: T[P] };
16+
var v01: Pick<T, keyof T>;
17+
var v01: Pick<Pick<T, keyof T>, keyof T>;
2118

22-
// Validate that non-isomorphic mapped types strip modifiers
23-
var v02: TU;
19+
var v02: TP;
20+
var v02: { [P in keyof T]?: T[P] };
21+
var v02: Partial<T>;
2422
var v02: Pick<TP, keyof T>;
25-
var v02: Pick<TPR, keyof T>;
26-
var v02: Pick<Partial<T>, keyof T>;
27-
var v02: Pick<Partial<Readonly<T>>, keyof T>;
2823

29-
// Validate that isomorphic mapped types preserve optional modifier
30-
var v03: TP;
31-
var v03: Partial<T>;
24+
var v03: TR;
25+
var v03: { readonly [P in keyof T]: T[P] };
26+
var v03: Readonly<T>;
27+
var v03: Pick<TR, keyof T>;
3228

33-
// Validate that isomorphic mapped types preserve readonly modifier
34-
var v04: TR;
35-
var v04: Readonly<T>;
36-
37-
// Validate that isomorphic mapped types preserve both partial and readonly modifiers
38-
var v05: TPR;
39-
var v05: Partial<TR>;
40-
var v05: Readonly<TP>;
41-
var v05: Partial<Readonly<T>>;
42-
var v05: Readonly<Partial<T>>;
29+
var v04: TPR;
30+
var v04: { readonly [P in keyof T]?: T[P] };
31+
var v04: Partial<TR>;
32+
var v04: Readonly<TP>;
33+
var v04: Partial<Readonly<T>>;
34+
var v04: Readonly<Partial<T>>;
35+
var v04: Pick<TPR, keyof T>;
4336

4437
type Boxified<T> = { [P in keyof T]: { x: T[P] } };
4538

4639
type B = { a: { x: number }, b: { x: string } };
47-
type BU = { a: { x: number } | undefined, b: { x: string } | undefined };
4840
type BP = { a?: { x: number }, b?: { x: string } };
4941
type BR = { readonly a: { x: number }, readonly b: { x: string } };
5042
type BPR = { readonly a?: { x: number }, readonly b?: { x: string } };
5143

52-
// Validate they all have the same keys
5344
var b00: "a" | "b";
5445
var b00: keyof B;
55-
var b00: keyof BU;
5646
var b00: keyof BP;
5747
var b00: keyof BR;
5848
var b00: keyof BPR;
5949

60-
// Validate that non-isomorphic mapped types strip modifiers
6150
var b01: B;
62-
var b01: Pick<BR, keyof B>;
63-
var b01: Pick<Readonly<BR>, keyof B>;
51+
var b01: { [P in keyof B]: B[P] };
52+
var b01: Pick<B, keyof B>;
53+
var b01: Pick<Pick<B, keyof B>, keyof B>;
6454

65-
// Validate that non-isomorphic mapped types strip modifiers
66-
var b02: BU;
55+
var b02: BP;
56+
var b02: { [P in keyof B]?: B[P] };
57+
var b02: Partial<B>;
6758
var b02: Pick<BP, keyof B>;
68-
var b02: Pick<BPR, keyof B>;
69-
var b02: Pick<Partial<B>, keyof B>;
70-
var b02: Pick<Partial<Readonly<B>>, keyof B>;
71-
72-
// Validate that isomorphic mapped types preserve optional modifier
73-
var b03: BP;
74-
var b03: Partial<B>;
7559

76-
// Validate that isomorphic mapped types preserve readonly modifier
77-
var b04: BR;
78-
var b04: Readonly<B>;
60+
var b03: BR;
61+
var b03: { readonly [P in keyof B]: B[P] };
62+
var b03: Readonly<B>;
63+
var b03: Pick<BR, keyof B>;
7964

80-
// Validate that isomorphic mapped types preserve both partial and readonly modifiers
81-
var b05: BPR;
82-
var b05: Partial<BR>;
83-
var b05: Readonly<BP>;
84-
var b05: Partial<Readonly<B>>;
85-
var b05: Readonly<Partial<B>>;
65+
var b04: BPR;
66+
var b04: { readonly [P in keyof B]?: B[P] };
67+
var b04: Partial<BR>;
68+
var b04: Readonly<BP>;
69+
var b04: Partial<Readonly<B>>;
70+
var b04: Readonly<Partial<B>>;
71+
var b04: Pick<BPR, keyof B>;
8672

8773
//// [mappedTypeModifiers.js]
88-
// Validate they all have the same keys
89-
var v00;
9074
var v00;
9175
var v00;
9276
var v00;
9377
var v00;
9478
var v00;
95-
// Validate that non-isomorphic mapped types strip modifiers
9679
var v01;
9780
var v01;
9881
var v01;
99-
// Validate that non-isomorphic mapped types strip modifiers
100-
var v02;
82+
var v01;
10183
var v02;
10284
var v02;
10385
var v02;
10486
var v02;
105-
// Validate that isomorphic mapped types preserve optional modifier
10687
var v03;
10788
var v03;
108-
// Validate that isomorphic mapped types preserve readonly modifier
89+
var v03;
90+
var v03;
91+
var v04;
92+
var v04;
93+
var v04;
94+
var v04;
95+
var v04;
10996
var v04;
11097
var v04;
111-
// Validate that isomorphic mapped types preserve both partial and readonly modifiers
112-
var v05;
113-
var v05;
114-
var v05;
115-
var v05;
116-
var v05;
117-
// Validate they all have the same keys
118-
var b00;
11998
var b00;
12099
var b00;
121100
var b00;
122101
var b00;
123102
var b00;
124-
// Validate that non-isomorphic mapped types strip modifiers
125103
var b01;
126104
var b01;
127105
var b01;
128-
// Validate that non-isomorphic mapped types strip modifiers
129-
var b02;
106+
var b01;
130107
var b02;
131108
var b02;
132109
var b02;
133110
var b02;
134-
// Validate that isomorphic mapped types preserve optional modifier
135111
var b03;
136112
var b03;
137-
// Validate that isomorphic mapped types preserve readonly modifier
113+
var b03;
114+
var b03;
115+
var b04;
116+
var b04;
117+
var b04;
118+
var b04;
119+
var b04;
138120
var b04;
139121
var b04;
140-
// Validate that isomorphic mapped types preserve both partial and readonly modifiers
141-
var b05;
142-
var b05;
143-
var b05;
144-
var b05;
145-
var b05;

0 commit comments

Comments
 (0)