Skip to content

Commit 6fbeced

Browse files
author
Andy
authored
Simplify test case (#20675)
1 parent 65e92c6 commit 6fbeced

4 files changed

+11
-97
lines changed
Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
11
//// [literalIntersectionYieldsLiteral.ts]
2-
export type BaseAttribute<T> = {
3-
type?: string;
4-
}
5-
export type StringAttribute = BaseAttribute<string> & {
6-
type: "string";
7-
}
8-
export type NumberAttribute = BaseAttribute<string> & {
9-
type: "number";
10-
}
11-
export type Attribute = StringAttribute | NumberAttribute;
12-
13-
const foo: Attribute = {
14-
type: "string"
15-
}
2+
const x: { type: string } & { type: "string" } = { type: "string" };
163

174

185
//// [literalIntersectionYieldsLiteral.js]
19-
"use strict";
20-
exports.__esModule = true;
21-
var foo = {
22-
type: "string"
23-
};
6+
var x = { type: "string" };
Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,7 @@
11
=== tests/cases/compiler/literalIntersectionYieldsLiteral.ts ===
2-
export type BaseAttribute<T> = {
3-
>BaseAttribute : Symbol(BaseAttribute, Decl(literalIntersectionYieldsLiteral.ts, 0, 0))
4-
>T : Symbol(T, Decl(literalIntersectionYieldsLiteral.ts, 0, 26))
5-
6-
type?: string;
7-
>type : Symbol(type, Decl(literalIntersectionYieldsLiteral.ts, 0, 32))
8-
}
9-
export type StringAttribute = BaseAttribute<string> & {
10-
>StringAttribute : Symbol(StringAttribute, Decl(literalIntersectionYieldsLiteral.ts, 2, 1))
11-
>BaseAttribute : Symbol(BaseAttribute, Decl(literalIntersectionYieldsLiteral.ts, 0, 0))
12-
13-
type: "string";
14-
>type : Symbol(type, Decl(literalIntersectionYieldsLiteral.ts, 3, 55))
15-
}
16-
export type NumberAttribute = BaseAttribute<string> & {
17-
>NumberAttribute : Symbol(NumberAttribute, Decl(literalIntersectionYieldsLiteral.ts, 5, 1))
18-
>BaseAttribute : Symbol(BaseAttribute, Decl(literalIntersectionYieldsLiteral.ts, 0, 0))
19-
20-
type: "number";
21-
>type : Symbol(type, Decl(literalIntersectionYieldsLiteral.ts, 6, 55))
22-
}
23-
export type Attribute = StringAttribute | NumberAttribute;
24-
>Attribute : Symbol(Attribute, Decl(literalIntersectionYieldsLiteral.ts, 8, 1))
25-
>StringAttribute : Symbol(StringAttribute, Decl(literalIntersectionYieldsLiteral.ts, 2, 1))
26-
>NumberAttribute : Symbol(NumberAttribute, Decl(literalIntersectionYieldsLiteral.ts, 5, 1))
27-
28-
const foo: Attribute = {
29-
>foo : Symbol(foo, Decl(literalIntersectionYieldsLiteral.ts, 11, 5))
30-
>Attribute : Symbol(Attribute, Decl(literalIntersectionYieldsLiteral.ts, 8, 1))
31-
32-
type: "string"
33-
>type : Symbol(type, Decl(literalIntersectionYieldsLiteral.ts, 11, 24))
34-
}
2+
const x: { type: string } & { type: "string" } = { type: "string" };
3+
>x : Symbol(x, Decl(literalIntersectionYieldsLiteral.ts, 0, 5))
4+
>type : Symbol(type, Decl(literalIntersectionYieldsLiteral.ts, 0, 10))
5+
>type : Symbol(type, Decl(literalIntersectionYieldsLiteral.ts, 0, 29))
6+
>type : Symbol(type, Decl(literalIntersectionYieldsLiteral.ts, 0, 50))
357

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,9 @@
11
=== tests/cases/compiler/literalIntersectionYieldsLiteral.ts ===
2-
export type BaseAttribute<T> = {
3-
>BaseAttribute : BaseAttribute<T>
4-
>T : T
5-
6-
type?: string;
2+
const x: { type: string } & { type: "string" } = { type: "string" };
3+
>x : { type: string; } & { type: "string"; }
74
>type : string
8-
}
9-
export type StringAttribute = BaseAttribute<string> & {
10-
>StringAttribute : StringAttribute
11-
>BaseAttribute : BaseAttribute<T>
12-
13-
type: "string";
145
>type : "string"
15-
}
16-
export type NumberAttribute = BaseAttribute<string> & {
17-
>NumberAttribute : NumberAttribute
18-
>BaseAttribute : BaseAttribute<T>
19-
20-
type: "number";
21-
>type : "number"
22-
}
23-
export type Attribute = StringAttribute | NumberAttribute;
24-
>Attribute : Attribute
25-
>StringAttribute : StringAttribute
26-
>NumberAttribute : NumberAttribute
27-
28-
const foo: Attribute = {
29-
>foo : Attribute
30-
>Attribute : Attribute
31-
>{ type: "string"} : { type: "string"; }
32-
33-
type: "string"
6+
>{ type: "string" } : { type: "string"; }
347
>type : string
358
>"string" : "string"
36-
}
379

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1 @@
1-
export type BaseAttribute<T> = {
2-
type?: string;
3-
}
4-
export type StringAttribute = BaseAttribute<string> & {
5-
type: "string";
6-
}
7-
export type NumberAttribute = BaseAttribute<string> & {
8-
type: "number";
9-
}
10-
export type Attribute = StringAttribute | NumberAttribute;
11-
12-
const foo: Attribute = {
13-
type: "string"
14-
}
1+
const x: { type: string } & { type: "string" } = { type: "string" };

0 commit comments

Comments
 (0)