Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0f6f7c3

Browse files
authored
Add a test case related to spreading objects (microsoft#57642)
1 parent 3b1b82a commit 0f6f7c3

File tree

3 files changed

+89
-0
lines changed

3 files changed

+89
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//// [tests/cases/compiler/spreadObjectNoCircular1.ts] ////
2+
3+
=== spreadObjectNoCircular1.ts ===
4+
type Box = {
5+
>Box : Symbol(Box, Decl(spreadObjectNoCircular1.ts, 0, 0))
6+
7+
content?: Foo | Box;
8+
>content : Symbol(content, Decl(spreadObjectNoCircular1.ts, 0, 12))
9+
>Foo : Symbol(Foo, Decl(spreadObjectNoCircular1.ts, 4, 21))
10+
>Box : Symbol(Box, Decl(spreadObjectNoCircular1.ts, 0, 0))
11+
12+
};
13+
14+
declare const b: Box;
15+
>b : Symbol(b, Decl(spreadObjectNoCircular1.ts, 4, 13))
16+
>Box : Symbol(Box, Decl(spreadObjectNoCircular1.ts, 0, 0))
17+
18+
class Foo {
19+
>Foo : Symbol(Foo, Decl(spreadObjectNoCircular1.ts, 4, 21))
20+
21+
get foo() {
22+
>foo : Symbol(Foo.foo, Decl(spreadObjectNoCircular1.ts, 6, 11))
23+
24+
return {
25+
content: this as Foo | Box,
26+
>content : Symbol(content, Decl(spreadObjectNoCircular1.ts, 8, 12))
27+
>this : Symbol(Foo, Decl(spreadObjectNoCircular1.ts, 4, 21))
28+
>Foo : Symbol(Foo, Decl(spreadObjectNoCircular1.ts, 4, 21))
29+
>Box : Symbol(Box, Decl(spreadObjectNoCircular1.ts, 0, 0))
30+
31+
...b,
32+
>b : Symbol(b, Decl(spreadObjectNoCircular1.ts, 4, 13))
33+
34+
};
35+
}
36+
}
37+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//// [tests/cases/compiler/spreadObjectNoCircular1.ts] ////
2+
3+
=== spreadObjectNoCircular1.ts ===
4+
type Box = {
5+
>Box : { content?: Foo | Box | undefined; }
6+
7+
content?: Foo | Box;
8+
>content : Foo | Box | undefined
9+
10+
};
11+
12+
declare const b: Box;
13+
>b : Box
14+
15+
class Foo {
16+
>Foo : Foo
17+
18+
get foo() {
19+
>foo : { content: Foo | Box; }
20+
21+
return {
22+
>{ content: this as Foo | Box, ...b, } : { content: Foo | Box; }
23+
24+
content: this as Foo | Box,
25+
>content : Foo | Box
26+
>this as Foo | Box : Foo | Box
27+
>this : this
28+
29+
...b,
30+
>b : Box
31+
32+
};
33+
}
34+
}
35+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// @strict: true
2+
// @noEmit: true
3+
4+
type Box = {
5+
content?: Foo | Box;
6+
};
7+
8+
declare const b: Box;
9+
10+
class Foo {
11+
get foo() {
12+
return {
13+
content: this as Foo | Box,
14+
...b,
15+
};
16+
}
17+
}

0 commit comments

Comments
 (0)