Simplify test case (#20675)

This commit is contained in:
Andy 2017-12-13 11:03:37 -08:00 committed by GitHub
parent 65e92c624b
commit 6fbeced025
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 97 deletions

View file

@ -1,23 +1,6 @@
//// [literalIntersectionYieldsLiteral.ts]
export type BaseAttribute<T> = {
type?: string;
}
export type StringAttribute = BaseAttribute<string> & {
type: "string";
}
export type NumberAttribute = BaseAttribute<string> & {
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" };

View file

@ -1,35 +1,7 @@
=== tests/cases/compiler/literalIntersectionYieldsLiteral.ts ===
export type BaseAttribute<T> = {
>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<string> & {
>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<string> & {
>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))

View file

@ -1,37 +1,9 @@
=== tests/cases/compiler/literalIntersectionYieldsLiteral.ts ===
export type BaseAttribute<T> = {
>BaseAttribute : BaseAttribute<T>
>T : T
type?: string;
const x: { type: string } & { type: "string" } = { type: "string" };
>x : { type: string; } & { type: "string"; }
>type : string
}
export type StringAttribute = BaseAttribute<string> & {
>StringAttribute : StringAttribute
>BaseAttribute : BaseAttribute<T>
type: "string";
>type : "string"
}
export type NumberAttribute = BaseAttribute<string> & {
>NumberAttribute : NumberAttribute
>BaseAttribute : BaseAttribute<T>
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"
}

View file

@ -1,14 +1 @@
export type BaseAttribute<T> = {
type?: string;
}
export type StringAttribute = BaseAttribute<string> & {
type: "string";
}
export type NumberAttribute = BaseAttribute<string> & {
type: "number";
}
export type Attribute = StringAttribute | NumberAttribute;
const foo: Attribute = {
type: "string"
}
const x: { type: string } & { type: "string" } = { type: "string" };