mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-13 04:57:55 -06:00
Add a test case related to spreading objects (#57642)
This commit is contained in:
parent
3b1b82a6bf
commit
0f6f7c308a
37
tests/baselines/reference/spreadObjectNoCircular1.symbols
Normal file
37
tests/baselines/reference/spreadObjectNoCircular1.symbols
Normal file
@ -0,0 +1,37 @@
|
||||
//// [tests/cases/compiler/spreadObjectNoCircular1.ts] ////
|
||||
|
||||
=== spreadObjectNoCircular1.ts ===
|
||||
type Box = {
|
||||
>Box : Symbol(Box, Decl(spreadObjectNoCircular1.ts, 0, 0))
|
||||
|
||||
content?: Foo | Box;
|
||||
>content : Symbol(content, Decl(spreadObjectNoCircular1.ts, 0, 12))
|
||||
>Foo : Symbol(Foo, Decl(spreadObjectNoCircular1.ts, 4, 21))
|
||||
>Box : Symbol(Box, Decl(spreadObjectNoCircular1.ts, 0, 0))
|
||||
|
||||
};
|
||||
|
||||
declare const b: Box;
|
||||
>b : Symbol(b, Decl(spreadObjectNoCircular1.ts, 4, 13))
|
||||
>Box : Symbol(Box, Decl(spreadObjectNoCircular1.ts, 0, 0))
|
||||
|
||||
class Foo {
|
||||
>Foo : Symbol(Foo, Decl(spreadObjectNoCircular1.ts, 4, 21))
|
||||
|
||||
get foo() {
|
||||
>foo : Symbol(Foo.foo, Decl(spreadObjectNoCircular1.ts, 6, 11))
|
||||
|
||||
return {
|
||||
content: this as Foo | Box,
|
||||
>content : Symbol(content, Decl(spreadObjectNoCircular1.ts, 8, 12))
|
||||
>this : Symbol(Foo, Decl(spreadObjectNoCircular1.ts, 4, 21))
|
||||
>Foo : Symbol(Foo, Decl(spreadObjectNoCircular1.ts, 4, 21))
|
||||
>Box : Symbol(Box, Decl(spreadObjectNoCircular1.ts, 0, 0))
|
||||
|
||||
...b,
|
||||
>b : Symbol(b, Decl(spreadObjectNoCircular1.ts, 4, 13))
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
35
tests/baselines/reference/spreadObjectNoCircular1.types
Normal file
35
tests/baselines/reference/spreadObjectNoCircular1.types
Normal file
@ -0,0 +1,35 @@
|
||||
//// [tests/cases/compiler/spreadObjectNoCircular1.ts] ////
|
||||
|
||||
=== spreadObjectNoCircular1.ts ===
|
||||
type Box = {
|
||||
>Box : { content?: Foo | Box | undefined; }
|
||||
|
||||
content?: Foo | Box;
|
||||
>content : Foo | Box | undefined
|
||||
|
||||
};
|
||||
|
||||
declare const b: Box;
|
||||
>b : Box
|
||||
|
||||
class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
get foo() {
|
||||
>foo : { content: Foo | Box; }
|
||||
|
||||
return {
|
||||
>{ content: this as Foo | Box, ...b, } : { content: Foo | Box; }
|
||||
|
||||
content: this as Foo | Box,
|
||||
>content : Foo | Box
|
||||
>this as Foo | Box : Foo | Box
|
||||
>this : this
|
||||
|
||||
...b,
|
||||
>b : Box
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
17
tests/cases/compiler/spreadObjectNoCircular1.ts
Normal file
17
tests/cases/compiler/spreadObjectNoCircular1.ts
Normal file
@ -0,0 +1,17 @@
|
||||
// @strict: true
|
||||
// @noEmit: true
|
||||
|
||||
type Box = {
|
||||
content?: Foo | Box;
|
||||
};
|
||||
|
||||
declare const b: Box;
|
||||
|
||||
class Foo {
|
||||
get foo() {
|
||||
return {
|
||||
content: this as Foo | Box,
|
||||
...b,
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user