Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6fbeced

Browse filesBrowse files
author
Andy
authored
Simplify test case (microsoft#20675)
1 parent 65e92c6 commit 6fbeced
Copy full SHA for 6fbeced

4 files changed

+11-97Lines changed: 11 additions & 97 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+2-19Lines 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" };
Collapse file
+5-33Lines 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

Collapse file
+3-31Lines 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

Collapse file
+1-14Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.