Skip to content

Commit 2ea0251

Browse files
committed
Accept new baselines
1 parent cf479fc commit 2ea0251

File tree

3 files changed

+150
-1
lines changed

3 files changed

+150
-1
lines changed

tests/baselines/reference/contextualTypeShouldBeLiteral.js

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,34 @@ let xyz: LikeA | LikeB = {
9393
}
9494
};
9595

96-
xyz;
96+
xyz;
97+
98+
// Repro from #29168
99+
100+
interface TestObject {
101+
type?: 'object';
102+
items: {
103+
[k: string]: TestGeneric;
104+
};
105+
}
106+
107+
interface TestString {
108+
type: 'string';
109+
}
110+
111+
type TestGeneric = (TestString | TestObject) & { [k: string]: any; };
112+
113+
const test: TestGeneric = {
114+
items: {
115+
hello: { type: 'string' },
116+
world: {
117+
items: {
118+
nested: { type: 'string' }
119+
}
120+
}
121+
}
122+
};
123+
97124

98125
//// [contextualTypeShouldBeLiteral.js]
99126
"use strict";
@@ -134,3 +161,13 @@ var xyz = {
134161
}
135162
};
136163
xyz;
164+
var test = {
165+
items: {
166+
hello: { type: 'string' },
167+
world: {
168+
items: {
169+
nested: { type: 'string' }
170+
}
171+
}
172+
}
173+
};

tests/baselines/reference/contextualTypeShouldBeLiteral.symbols

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,59 @@ let xyz: LikeA | LikeB = {
227227
xyz;
228228
>xyz : Symbol(xyz, Decl(contextualTypeShouldBeLiteral.ts, 82, 3))
229229

230+
// Repro from #29168
231+
232+
interface TestObject {
233+
>TestObject : Symbol(TestObject, Decl(contextualTypeShouldBeLiteral.ts, 94, 4))
234+
235+
type?: 'object';
236+
>type : Symbol(TestObject.type, Decl(contextualTypeShouldBeLiteral.ts, 98, 22))
237+
238+
items: {
239+
>items : Symbol(TestObject.items, Decl(contextualTypeShouldBeLiteral.ts, 99, 18))
240+
241+
[k: string]: TestGeneric;
242+
>k : Symbol(k, Decl(contextualTypeShouldBeLiteral.ts, 101, 5))
243+
>TestGeneric : Symbol(TestGeneric, Decl(contextualTypeShouldBeLiteral.ts, 107, 1))
244+
245+
};
246+
}
247+
248+
interface TestString {
249+
>TestString : Symbol(TestString, Decl(contextualTypeShouldBeLiteral.ts, 103, 1))
250+
251+
type: 'string';
252+
>type : Symbol(TestString.type, Decl(contextualTypeShouldBeLiteral.ts, 105, 22))
253+
}
254+
255+
type TestGeneric = (TestString | TestObject) & { [k: string]: any; };
256+
>TestGeneric : Symbol(TestGeneric, Decl(contextualTypeShouldBeLiteral.ts, 107, 1))
257+
>TestString : Symbol(TestString, Decl(contextualTypeShouldBeLiteral.ts, 103, 1))
258+
>TestObject : Symbol(TestObject, Decl(contextualTypeShouldBeLiteral.ts, 94, 4))
259+
>k : Symbol(k, Decl(contextualTypeShouldBeLiteral.ts, 109, 50))
260+
261+
const test: TestGeneric = {
262+
>test : Symbol(test, Decl(contextualTypeShouldBeLiteral.ts, 111, 5))
263+
>TestGeneric : Symbol(TestGeneric, Decl(contextualTypeShouldBeLiteral.ts, 107, 1))
264+
265+
items: {
266+
>items : Symbol(items, Decl(contextualTypeShouldBeLiteral.ts, 111, 27))
267+
268+
hello: { type: 'string' },
269+
>hello : Symbol(hello, Decl(contextualTypeShouldBeLiteral.ts, 112, 10))
270+
>type : Symbol(type, Decl(contextualTypeShouldBeLiteral.ts, 113, 12))
271+
272+
world: {
273+
>world : Symbol(world, Decl(contextualTypeShouldBeLiteral.ts, 113, 30))
274+
275+
items: {
276+
>items : Symbol(items, Decl(contextualTypeShouldBeLiteral.ts, 114, 12))
277+
278+
nested: { type: 'string' }
279+
>nested : Symbol(nested, Decl(contextualTypeShouldBeLiteral.ts, 115, 14))
280+
>type : Symbol(type, Decl(contextualTypeShouldBeLiteral.ts, 116, 17))
281+
}
282+
}
283+
}
284+
};
285+

tests/baselines/reference/contextualTypeShouldBeLiteral.types

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,59 @@ let xyz: LikeA | LikeB = {
222222
xyz;
223223
>xyz : LikeA
224224

225+
// Repro from #29168
226+
227+
interface TestObject {
228+
type?: 'object';
229+
>type : "object" | undefined
230+
231+
items: {
232+
>items : { [k: string]: TestGeneric; }
233+
234+
[k: string]: TestGeneric;
235+
>k : string
236+
237+
};
238+
}
239+
240+
interface TestString {
241+
type: 'string';
242+
>type : "string"
243+
}
244+
245+
type TestGeneric = (TestString | TestObject) & { [k: string]: any; };
246+
>TestGeneric : TestGeneric
247+
>k : string
248+
249+
const test: TestGeneric = {
250+
>test : TestGeneric
251+
>{ items: { hello: { type: 'string' }, world: { items: { nested: { type: 'string' } } } }} : { items: { hello: { type: "string"; }; world: { items: { nested: { type: "string"; }; }; }; }; }
252+
253+
items: {
254+
>items : { hello: { type: "string"; }; world: { items: { nested: { type: "string"; }; }; }; }
255+
>{ hello: { type: 'string' }, world: { items: { nested: { type: 'string' } } } } : { hello: { type: "string"; }; world: { items: { nested: { type: "string"; }; }; }; }
256+
257+
hello: { type: 'string' },
258+
>hello : { type: "string"; }
259+
>{ type: 'string' } : { type: "string"; }
260+
>type : "string"
261+
>'string' : "string"
262+
263+
world: {
264+
>world : { items: { nested: { type: "string"; }; }; }
265+
>{ items: { nested: { type: 'string' } } } : { items: { nested: { type: "string"; }; }; }
266+
267+
items: {
268+
>items : { nested: { type: "string"; }; }
269+
>{ nested: { type: 'string' } } : { nested: { type: "string"; }; }
270+
271+
nested: { type: 'string' }
272+
>nested : { type: "string"; }
273+
>{ type: 'string' } : { type: "string"; }
274+
>type : "string"
275+
>'string' : "string"
276+
}
277+
}
278+
}
279+
};
280+

0 commit comments

Comments
 (0)