Skip to content

Commit 4a8f340

Browse files
committed
Accept new baselines
1 parent f834caf commit 4a8f340

File tree

3 files changed

+272
-0
lines changed

3 files changed

+272
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
//// [mappedTypesAndObjects.ts]
2+
3+
function f1<T>(x: Partial<T>, y: Readonly<T>) {
4+
let obj: {};
5+
obj = x;
6+
obj = y;
7+
}
8+
9+
function f2<T>(x: Partial<T>, y: Readonly<T>) {
10+
let obj: { [x: string]: any };
11+
obj = x;
12+
obj = y;
13+
}
14+
15+
// Repro from #12900
16+
17+
interface Base {
18+
foo: { [key: string]: any };
19+
bar: any;
20+
baz: any;
21+
}
22+
23+
interface E1<T> extends Base {
24+
foo: T;
25+
}
26+
27+
interface Something { name: string, value: string };
28+
interface E2 extends Base {
29+
foo: Partial<Something>; // or other mapped type
30+
}
31+
32+
interface E3<T> extends Base {
33+
foo: Partial<T>; // or other mapped type
34+
}
35+
36+
//// [mappedTypesAndObjects.js]
37+
function f1(x, y) {
38+
var obj;
39+
obj = x;
40+
obj = y;
41+
}
42+
function f2(x, y) {
43+
var obj;
44+
obj = x;
45+
obj = y;
46+
}
47+
;
48+
49+
50+
//// [mappedTypesAndObjects.d.ts]
51+
declare function f1<T>(x: Partial<T>, y: Readonly<T>): void;
52+
declare function f2<T>(x: Partial<T>, y: Readonly<T>): void;
53+
interface Base {
54+
foo: {
55+
[key: string]: any;
56+
};
57+
bar: any;
58+
baz: any;
59+
}
60+
interface E1<T> extends Base {
61+
foo: T;
62+
}
63+
interface Something {
64+
name: string;
65+
value: string;
66+
}
67+
interface E2 extends Base {
68+
foo: Partial<Something>;
69+
}
70+
interface E3<T> extends Base {
71+
foo: Partial<T>;
72+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
=== tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts ===
2+
3+
function f1<T>(x: Partial<T>, y: Readonly<T>) {
4+
>f1 : Symbol(f1, Decl(mappedTypesAndObjects.ts, 0, 0))
5+
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 1, 12))
6+
>x : Symbol(x, Decl(mappedTypesAndObjects.ts, 1, 15))
7+
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
8+
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 1, 12))
9+
>y : Symbol(y, Decl(mappedTypesAndObjects.ts, 1, 29))
10+
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
11+
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 1, 12))
12+
13+
let obj: {};
14+
>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 2, 7))
15+
16+
obj = x;
17+
>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 2, 7))
18+
>x : Symbol(x, Decl(mappedTypesAndObjects.ts, 1, 15))
19+
20+
obj = y;
21+
>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 2, 7))
22+
>y : Symbol(y, Decl(mappedTypesAndObjects.ts, 1, 29))
23+
}
24+
25+
function f2<T>(x: Partial<T>, y: Readonly<T>) {
26+
>f2 : Symbol(f2, Decl(mappedTypesAndObjects.ts, 5, 1))
27+
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 7, 12))
28+
>x : Symbol(x, Decl(mappedTypesAndObjects.ts, 7, 15))
29+
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
30+
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 7, 12))
31+
>y : Symbol(y, Decl(mappedTypesAndObjects.ts, 7, 29))
32+
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
33+
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 7, 12))
34+
35+
let obj: { [x: string]: any };
36+
>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 8, 7))
37+
>x : Symbol(x, Decl(mappedTypesAndObjects.ts, 8, 16))
38+
39+
obj = x;
40+
>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 8, 7))
41+
>x : Symbol(x, Decl(mappedTypesAndObjects.ts, 7, 15))
42+
43+
obj = y;
44+
>obj : Symbol(obj, Decl(mappedTypesAndObjects.ts, 8, 7))
45+
>y : Symbol(y, Decl(mappedTypesAndObjects.ts, 7, 29))
46+
}
47+
48+
// Repro from #12900
49+
50+
interface Base {
51+
>Base : Symbol(Base, Decl(mappedTypesAndObjects.ts, 11, 1))
52+
53+
foo: { [key: string]: any };
54+
>foo : Symbol(Base.foo, Decl(mappedTypesAndObjects.ts, 15, 16))
55+
>key : Symbol(key, Decl(mappedTypesAndObjects.ts, 16, 11))
56+
57+
bar: any;
58+
>bar : Symbol(Base.bar, Decl(mappedTypesAndObjects.ts, 16, 31))
59+
60+
baz: any;
61+
>baz : Symbol(Base.baz, Decl(mappedTypesAndObjects.ts, 17, 12))
62+
}
63+
64+
interface E1<T> extends Base {
65+
>E1 : Symbol(E1, Decl(mappedTypesAndObjects.ts, 19, 1))
66+
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 21, 13))
67+
>Base : Symbol(Base, Decl(mappedTypesAndObjects.ts, 11, 1))
68+
69+
foo: T;
70+
>foo : Symbol(E1.foo, Decl(mappedTypesAndObjects.ts, 21, 30))
71+
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 21, 13))
72+
}
73+
74+
interface Something { name: string, value: string };
75+
>Something : Symbol(Something, Decl(mappedTypesAndObjects.ts, 23, 1))
76+
>name : Symbol(Something.name, Decl(mappedTypesAndObjects.ts, 25, 21))
77+
>value : Symbol(Something.value, Decl(mappedTypesAndObjects.ts, 25, 35))
78+
79+
interface E2 extends Base {
80+
>E2 : Symbol(E2, Decl(mappedTypesAndObjects.ts, 25, 52))
81+
>Base : Symbol(Base, Decl(mappedTypesAndObjects.ts, 11, 1))
82+
83+
foo: Partial<Something>; // or other mapped type
84+
>foo : Symbol(E2.foo, Decl(mappedTypesAndObjects.ts, 26, 27))
85+
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
86+
>Something : Symbol(Something, Decl(mappedTypesAndObjects.ts, 23, 1))
87+
}
88+
89+
interface E3<T> extends Base {
90+
>E3 : Symbol(E3, Decl(mappedTypesAndObjects.ts, 28, 1))
91+
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 30, 13))
92+
>Base : Symbol(Base, Decl(mappedTypesAndObjects.ts, 11, 1))
93+
94+
foo: Partial<T>; // or other mapped type
95+
>foo : Symbol(E3.foo, Decl(mappedTypesAndObjects.ts, 30, 30))
96+
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
97+
>T : Symbol(T, Decl(mappedTypesAndObjects.ts, 30, 13))
98+
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
=== tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts ===
2+
3+
function f1<T>(x: Partial<T>, y: Readonly<T>) {
4+
>f1 : <T>(x: Partial<T>, y: Readonly<T>) => void
5+
>T : T
6+
>x : Partial<T>
7+
>Partial : Partial<T>
8+
>T : T
9+
>y : Readonly<T>
10+
>Readonly : Readonly<T>
11+
>T : T
12+
13+
let obj: {};
14+
>obj : {}
15+
16+
obj = x;
17+
>obj = x : Partial<T>
18+
>obj : {}
19+
>x : Partial<T>
20+
21+
obj = y;
22+
>obj = y : Readonly<T>
23+
>obj : {}
24+
>y : Readonly<T>
25+
}
26+
27+
function f2<T>(x: Partial<T>, y: Readonly<T>) {
28+
>f2 : <T>(x: Partial<T>, y: Readonly<T>) => void
29+
>T : T
30+
>x : Partial<T>
31+
>Partial : Partial<T>
32+
>T : T
33+
>y : Readonly<T>
34+
>Readonly : Readonly<T>
35+
>T : T
36+
37+
let obj: { [x: string]: any };
38+
>obj : { [x: string]: any; }
39+
>x : string
40+
41+
obj = x;
42+
>obj = x : Partial<T>
43+
>obj : { [x: string]: any; }
44+
>x : Partial<T>
45+
46+
obj = y;
47+
>obj = y : Readonly<T>
48+
>obj : { [x: string]: any; }
49+
>y : Readonly<T>
50+
}
51+
52+
// Repro from #12900
53+
54+
interface Base {
55+
>Base : Base
56+
57+
foo: { [key: string]: any };
58+
>foo : { [key: string]: any; }
59+
>key : string
60+
61+
bar: any;
62+
>bar : any
63+
64+
baz: any;
65+
>baz : any
66+
}
67+
68+
interface E1<T> extends Base {
69+
>E1 : E1<T>
70+
>T : T
71+
>Base : Base
72+
73+
foo: T;
74+
>foo : T
75+
>T : T
76+
}
77+
78+
interface Something { name: string, value: string };
79+
>Something : Something
80+
>name : string
81+
>value : string
82+
83+
interface E2 extends Base {
84+
>E2 : E2
85+
>Base : Base
86+
87+
foo: Partial<Something>; // or other mapped type
88+
>foo : Partial<Something>
89+
>Partial : Partial<T>
90+
>Something : Something
91+
}
92+
93+
interface E3<T> extends Base {
94+
>E3 : E3<T>
95+
>T : T
96+
>Base : Base
97+
98+
foo: Partial<T>; // or other mapped type
99+
>foo : Partial<T>
100+
>Partial : Partial<T>
101+
>T : T
102+
}

0 commit comments

Comments
 (0)