Skip to content

Commit 8e47c18

Browse files
committed
Accept new baselines
1 parent ee0715a commit 8e47c18

File tree

4 files changed

+236
-0
lines changed

4 files changed

+236
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
tests/cases/conformance/types/mapped/mappedTypeWithAny.ts(23,16): error TS2339: Property 'notAValue' does not exist on type 'Data'.
2+
3+
4+
==== tests/cases/conformance/types/mapped/mappedTypeWithAny.ts (1 errors) ====
5+
type Item = { value: string };
6+
type ItemMap<T> = { [P in keyof T]: Item };
7+
8+
declare let x0: keyof any;
9+
declare let x1: { [P in any]: Item };
10+
declare let x2: { [P in string]: Item };
11+
declare let x3: { [P in keyof any]: Item };
12+
declare let x4: ItemMap<any>;
13+
14+
// Repro from #19152
15+
16+
type Data = {
17+
value: string;
18+
}
19+
20+
type StrictDataMap<T> = {
21+
[P in keyof T]: Data
22+
}
23+
24+
declare let z: StrictDataMap<any>;
25+
for (let id in z) {
26+
let data = z[id];
27+
let x = data.notAValue; // Error
28+
~~~~~~~~~
29+
!!! error TS2339: Property 'notAValue' does not exist on type 'Data'.
30+
}
31+
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
//// [mappedTypeWithAny.ts]
2+
type Item = { value: string };
3+
type ItemMap<T> = { [P in keyof T]: Item };
4+
5+
declare let x0: keyof any;
6+
declare let x1: { [P in any]: Item };
7+
declare let x2: { [P in string]: Item };
8+
declare let x3: { [P in keyof any]: Item };
9+
declare let x4: ItemMap<any>;
10+
11+
// Repro from #19152
12+
13+
type Data = {
14+
value: string;
15+
}
16+
17+
type StrictDataMap<T> = {
18+
[P in keyof T]: Data
19+
}
20+
21+
declare let z: StrictDataMap<any>;
22+
for (let id in z) {
23+
let data = z[id];
24+
let x = data.notAValue; // Error
25+
}
26+
27+
28+
//// [mappedTypeWithAny.js]
29+
"use strict";
30+
for (var id in z) {
31+
var data = z[id];
32+
var x = data.notAValue; // Error
33+
}
34+
35+
36+
//// [mappedTypeWithAny.d.ts]
37+
declare type Item = {
38+
value: string;
39+
};
40+
declare type ItemMap<T> = {
41+
[P in keyof T]: Item;
42+
};
43+
declare let x0: keyof any;
44+
declare let x1: {
45+
[P in any]: Item;
46+
};
47+
declare let x2: {
48+
[P in string]: Item;
49+
};
50+
declare let x3: {
51+
[P in keyof any]: Item;
52+
};
53+
declare let x4: ItemMap<any>;
54+
declare type Data = {
55+
value: string;
56+
};
57+
declare type StrictDataMap<T> = {
58+
[P in keyof T]: Data;
59+
};
60+
declare let z: StrictDataMap<any>;
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
=== tests/cases/conformance/types/mapped/mappedTypeWithAny.ts ===
2+
type Item = { value: string };
3+
>Item : Symbol(Item, Decl(mappedTypeWithAny.ts, 0, 0))
4+
>value : Symbol(value, Decl(mappedTypeWithAny.ts, 0, 13))
5+
6+
type ItemMap<T> = { [P in keyof T]: Item };
7+
>ItemMap : Symbol(ItemMap, Decl(mappedTypeWithAny.ts, 0, 30))
8+
>T : Symbol(T, Decl(mappedTypeWithAny.ts, 1, 13))
9+
>P : Symbol(P, Decl(mappedTypeWithAny.ts, 1, 21))
10+
>T : Symbol(T, Decl(mappedTypeWithAny.ts, 1, 13))
11+
>Item : Symbol(Item, Decl(mappedTypeWithAny.ts, 0, 0))
12+
13+
declare let x0: keyof any;
14+
>x0 : Symbol(x0, Decl(mappedTypeWithAny.ts, 3, 11))
15+
16+
declare let x1: { [P in any]: Item };
17+
>x1 : Symbol(x1, Decl(mappedTypeWithAny.ts, 4, 11))
18+
>P : Symbol(P, Decl(mappedTypeWithAny.ts, 4, 19))
19+
>Item : Symbol(Item, Decl(mappedTypeWithAny.ts, 0, 0))
20+
21+
declare let x2: { [P in string]: Item };
22+
>x2 : Symbol(x2, Decl(mappedTypeWithAny.ts, 5, 11))
23+
>P : Symbol(P, Decl(mappedTypeWithAny.ts, 5, 19))
24+
>Item : Symbol(Item, Decl(mappedTypeWithAny.ts, 0, 0))
25+
26+
declare let x3: { [P in keyof any]: Item };
27+
>x3 : Symbol(x3, Decl(mappedTypeWithAny.ts, 6, 11))
28+
>P : Symbol(P, Decl(mappedTypeWithAny.ts, 6, 19))
29+
>Item : Symbol(Item, Decl(mappedTypeWithAny.ts, 0, 0))
30+
31+
declare let x4: ItemMap<any>;
32+
>x4 : Symbol(x4, Decl(mappedTypeWithAny.ts, 7, 11))
33+
>ItemMap : Symbol(ItemMap, Decl(mappedTypeWithAny.ts, 0, 30))
34+
35+
// Repro from #19152
36+
37+
type Data = {
38+
>Data : Symbol(Data, Decl(mappedTypeWithAny.ts, 7, 29))
39+
40+
value: string;
41+
>value : Symbol(value, Decl(mappedTypeWithAny.ts, 11, 13))
42+
}
43+
44+
type StrictDataMap<T> = {
45+
>StrictDataMap : Symbol(StrictDataMap, Decl(mappedTypeWithAny.ts, 13, 1))
46+
>T : Symbol(T, Decl(mappedTypeWithAny.ts, 15, 19))
47+
48+
[P in keyof T]: Data
49+
>P : Symbol(P, Decl(mappedTypeWithAny.ts, 16, 3))
50+
>T : Symbol(T, Decl(mappedTypeWithAny.ts, 15, 19))
51+
>Data : Symbol(Data, Decl(mappedTypeWithAny.ts, 7, 29))
52+
}
53+
54+
declare let z: StrictDataMap<any>;
55+
>z : Symbol(z, Decl(mappedTypeWithAny.ts, 19, 11))
56+
>StrictDataMap : Symbol(StrictDataMap, Decl(mappedTypeWithAny.ts, 13, 1))
57+
58+
for (let id in z) {
59+
>id : Symbol(id, Decl(mappedTypeWithAny.ts, 20, 8))
60+
>z : Symbol(z, Decl(mappedTypeWithAny.ts, 19, 11))
61+
62+
let data = z[id];
63+
>data : Symbol(data, Decl(mappedTypeWithAny.ts, 21, 5))
64+
>z : Symbol(z, Decl(mappedTypeWithAny.ts, 19, 11))
65+
>id : Symbol(id, Decl(mappedTypeWithAny.ts, 20, 8))
66+
67+
let x = data.notAValue; // Error
68+
>x : Symbol(x, Decl(mappedTypeWithAny.ts, 22, 5))
69+
>data : Symbol(data, Decl(mappedTypeWithAny.ts, 21, 5))
70+
}
71+
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
=== tests/cases/conformance/types/mapped/mappedTypeWithAny.ts ===
2+
type Item = { value: string };
3+
>Item : Item
4+
>value : string
5+
6+
type ItemMap<T> = { [P in keyof T]: Item };
7+
>ItemMap : ItemMap<T>
8+
>T : T
9+
>P : P
10+
>T : T
11+
>Item : Item
12+
13+
declare let x0: keyof any;
14+
>x0 : string
15+
16+
declare let x1: { [P in any]: Item };
17+
>x1 : { [x: string]: Item; }
18+
>P : P
19+
>Item : Item
20+
21+
declare let x2: { [P in string]: Item };
22+
>x2 : { [x: string]: Item; }
23+
>P : P
24+
>Item : Item
25+
26+
declare let x3: { [P in keyof any]: Item };
27+
>x3 : { [x: string]: Item; }
28+
>P : P
29+
>Item : Item
30+
31+
declare let x4: ItemMap<any>;
32+
>x4 : ItemMap<any>
33+
>ItemMap : ItemMap<T>
34+
35+
// Repro from #19152
36+
37+
type Data = {
38+
>Data : Data
39+
40+
value: string;
41+
>value : string
42+
}
43+
44+
type StrictDataMap<T> = {
45+
>StrictDataMap : StrictDataMap<T>
46+
>T : T
47+
48+
[P in keyof T]: Data
49+
>P : P
50+
>T : T
51+
>Data : Data
52+
}
53+
54+
declare let z: StrictDataMap<any>;
55+
>z : StrictDataMap<any>
56+
>StrictDataMap : StrictDataMap<T>
57+
58+
for (let id in z) {
59+
>id : string
60+
>z : StrictDataMap<any>
61+
62+
let data = z[id];
63+
>data : Data
64+
>z[id] : Data
65+
>z : StrictDataMap<any>
66+
>id : string
67+
68+
let x = data.notAValue; // Error
69+
>x : any
70+
>data.notAValue : any
71+
>data : Data
72+
>notAValue : any
73+
}
74+

0 commit comments

Comments
 (0)