diff --git a/tests/baselines/reference/literalIntersectionYieldsLiteral.js b/tests/baselines/reference/literalIntersectionYieldsLiteral.js index 7781ad9bd3..e0cd514fcb 100644 --- a/tests/baselines/reference/literalIntersectionYieldsLiteral.js +++ b/tests/baselines/reference/literalIntersectionYieldsLiteral.js @@ -1,23 +1,6 @@ //// [literalIntersectionYieldsLiteral.ts] -export type BaseAttribute = { - type?: string; -} -export type StringAttribute = BaseAttribute & { - type: "string"; -} -export type NumberAttribute = BaseAttribute & { - type: "number"; -} -export type Attribute = StringAttribute | NumberAttribute; - -const foo: Attribute = { - type: "string" -} +const x: { type: string } & { type: "string" } = { type: "string" }; //// [literalIntersectionYieldsLiteral.js] -"use strict"; -exports.__esModule = true; -var foo = { - type: "string" -}; +var x = { type: "string" }; diff --git a/tests/baselines/reference/literalIntersectionYieldsLiteral.symbols b/tests/baselines/reference/literalIntersectionYieldsLiteral.symbols index 2b2c207270..85b6ab537c 100644 --- a/tests/baselines/reference/literalIntersectionYieldsLiteral.symbols +++ b/tests/baselines/reference/literalIntersectionYieldsLiteral.symbols @@ -1,35 +1,7 @@ === tests/cases/compiler/literalIntersectionYieldsLiteral.ts === -export type BaseAttribute = { ->BaseAttribute : Symbol(BaseAttribute, Decl(literalIntersectionYieldsLiteral.ts, 0, 0)) ->T : Symbol(T, Decl(literalIntersectionYieldsLiteral.ts, 0, 26)) - - type?: string; ->type : Symbol(type, Decl(literalIntersectionYieldsLiteral.ts, 0, 32)) -} -export type StringAttribute = BaseAttribute & { ->StringAttribute : Symbol(StringAttribute, Decl(literalIntersectionYieldsLiteral.ts, 2, 1)) ->BaseAttribute : Symbol(BaseAttribute, Decl(literalIntersectionYieldsLiteral.ts, 0, 0)) - - type: "string"; ->type : Symbol(type, Decl(literalIntersectionYieldsLiteral.ts, 3, 55)) -} -export type NumberAttribute = BaseAttribute & { ->NumberAttribute : Symbol(NumberAttribute, Decl(literalIntersectionYieldsLiteral.ts, 5, 1)) ->BaseAttribute : Symbol(BaseAttribute, Decl(literalIntersectionYieldsLiteral.ts, 0, 0)) - - type: "number"; ->type : Symbol(type, Decl(literalIntersectionYieldsLiteral.ts, 6, 55)) -} -export type Attribute = StringAttribute | NumberAttribute; ->Attribute : Symbol(Attribute, Decl(literalIntersectionYieldsLiteral.ts, 8, 1)) ->StringAttribute : Symbol(StringAttribute, Decl(literalIntersectionYieldsLiteral.ts, 2, 1)) ->NumberAttribute : Symbol(NumberAttribute, Decl(literalIntersectionYieldsLiteral.ts, 5, 1)) - -const foo: Attribute = { ->foo : Symbol(foo, Decl(literalIntersectionYieldsLiteral.ts, 11, 5)) ->Attribute : Symbol(Attribute, Decl(literalIntersectionYieldsLiteral.ts, 8, 1)) - - type: "string" ->type : Symbol(type, Decl(literalIntersectionYieldsLiteral.ts, 11, 24)) -} +const x: { type: string } & { type: "string" } = { type: "string" }; +>x : Symbol(x, Decl(literalIntersectionYieldsLiteral.ts, 0, 5)) +>type : Symbol(type, Decl(literalIntersectionYieldsLiteral.ts, 0, 10)) +>type : Symbol(type, Decl(literalIntersectionYieldsLiteral.ts, 0, 29)) +>type : Symbol(type, Decl(literalIntersectionYieldsLiteral.ts, 0, 50)) diff --git a/tests/baselines/reference/literalIntersectionYieldsLiteral.types b/tests/baselines/reference/literalIntersectionYieldsLiteral.types index 2230f14af1..b169a19aef 100644 --- a/tests/baselines/reference/literalIntersectionYieldsLiteral.types +++ b/tests/baselines/reference/literalIntersectionYieldsLiteral.types @@ -1,37 +1,9 @@ === tests/cases/compiler/literalIntersectionYieldsLiteral.ts === -export type BaseAttribute = { ->BaseAttribute : BaseAttribute ->T : T - - type?: string; +const x: { type: string } & { type: "string" } = { type: "string" }; +>x : { type: string; } & { type: "string"; } >type : string -} -export type StringAttribute = BaseAttribute & { ->StringAttribute : StringAttribute ->BaseAttribute : BaseAttribute - - type: "string"; >type : "string" -} -export type NumberAttribute = BaseAttribute & { ->NumberAttribute : NumberAttribute ->BaseAttribute : BaseAttribute - - type: "number"; ->type : "number" -} -export type Attribute = StringAttribute | NumberAttribute; ->Attribute : Attribute ->StringAttribute : StringAttribute ->NumberAttribute : NumberAttribute - -const foo: Attribute = { ->foo : Attribute ->Attribute : Attribute ->{ type: "string"} : { type: "string"; } - - type: "string" +>{ type: "string" } : { type: "string"; } >type : string >"string" : "string" -} diff --git a/tests/cases/compiler/literalIntersectionYieldsLiteral.ts b/tests/cases/compiler/literalIntersectionYieldsLiteral.ts index 3b65201d3a..11ab5d6d6b 100644 --- a/tests/cases/compiler/literalIntersectionYieldsLiteral.ts +++ b/tests/cases/compiler/literalIntersectionYieldsLiteral.ts @@ -1,14 +1 @@ -export type BaseAttribute = { - type?: string; -} -export type StringAttribute = BaseAttribute & { - type: "string"; -} -export type NumberAttribute = BaseAttribute & { - type: "number"; -} -export type Attribute = StringAttribute | NumberAttribute; - -const foo: Attribute = { - type: "string" -} +const x: { type: string } & { type: "string" } = { type: "string" };