diff --git a/tests/baselines/reference/spreadObjectNoCircular1.symbols b/tests/baselines/reference/spreadObjectNoCircular1.symbols new file mode 100644 index 0000000000000..4fe525b49a31b --- /dev/null +++ b/tests/baselines/reference/spreadObjectNoCircular1.symbols @@ -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)) + + }; + } +} + diff --git a/tests/baselines/reference/spreadObjectNoCircular1.types b/tests/baselines/reference/spreadObjectNoCircular1.types new file mode 100644 index 0000000000000..9fa4a6358f437 --- /dev/null +++ b/tests/baselines/reference/spreadObjectNoCircular1.types @@ -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 + + }; + } +} + diff --git a/tests/cases/compiler/spreadObjectNoCircular1.ts b/tests/cases/compiler/spreadObjectNoCircular1.ts new file mode 100644 index 0000000000000..90d486ed645a7 --- /dev/null +++ b/tests/cases/compiler/spreadObjectNoCircular1.ts @@ -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, + }; + } +}