Skip to content

Commit

Permalink
Accept new baselines
Browse files Browse the repository at this point in the history
  • Loading branch information
ahejlsberg committed Jan 20, 2019
1 parent cf479fc commit 2ea0251
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 1 deletion.
39 changes: 38 additions & 1 deletion tests/baselines/reference/contextualTypeShouldBeLiteral.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,34 @@ let xyz: LikeA | LikeB = {
}
};

xyz;
xyz;

// Repro from #29168

interface TestObject {
type?: 'object';
items: {
[k: string]: TestGeneric;
};
}

interface TestString {
type: 'string';
}

type TestGeneric = (TestString | TestObject) & { [k: string]: any; };

const test: TestGeneric = {
items: {
hello: { type: 'string' },
world: {
items: {
nested: { type: 'string' }
}
}
}
};


//// [contextualTypeShouldBeLiteral.js]
"use strict";
Expand Down Expand Up @@ -134,3 +161,13 @@ var xyz = {
}
};
xyz;
var test = {
items: {
hello: { type: 'string' },
world: {
items: {
nested: { type: 'string' }
}
}
}
};
56 changes: 56 additions & 0 deletions tests/baselines/reference/contextualTypeShouldBeLiteral.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,59 @@ let xyz: LikeA | LikeB = {
xyz;
>xyz : Symbol(xyz, Decl(contextualTypeShouldBeLiteral.ts, 82, 3))

// Repro from #29168

interface TestObject {
>TestObject : Symbol(TestObject, Decl(contextualTypeShouldBeLiteral.ts, 94, 4))

type?: 'object';
>type : Symbol(TestObject.type, Decl(contextualTypeShouldBeLiteral.ts, 98, 22))

items: {
>items : Symbol(TestObject.items, Decl(contextualTypeShouldBeLiteral.ts, 99, 18))

[k: string]: TestGeneric;
>k : Symbol(k, Decl(contextualTypeShouldBeLiteral.ts, 101, 5))
>TestGeneric : Symbol(TestGeneric, Decl(contextualTypeShouldBeLiteral.ts, 107, 1))

};
}

interface TestString {
>TestString : Symbol(TestString, Decl(contextualTypeShouldBeLiteral.ts, 103, 1))

type: 'string';
>type : Symbol(TestString.type, Decl(contextualTypeShouldBeLiteral.ts, 105, 22))
}

type TestGeneric = (TestString | TestObject) & { [k: string]: any; };
>TestGeneric : Symbol(TestGeneric, Decl(contextualTypeShouldBeLiteral.ts, 107, 1))
>TestString : Symbol(TestString, Decl(contextualTypeShouldBeLiteral.ts, 103, 1))
>TestObject : Symbol(TestObject, Decl(contextualTypeShouldBeLiteral.ts, 94, 4))
>k : Symbol(k, Decl(contextualTypeShouldBeLiteral.ts, 109, 50))

const test: TestGeneric = {
>test : Symbol(test, Decl(contextualTypeShouldBeLiteral.ts, 111, 5))
>TestGeneric : Symbol(TestGeneric, Decl(contextualTypeShouldBeLiteral.ts, 107, 1))

items: {
>items : Symbol(items, Decl(contextualTypeShouldBeLiteral.ts, 111, 27))

hello: { type: 'string' },
>hello : Symbol(hello, Decl(contextualTypeShouldBeLiteral.ts, 112, 10))
>type : Symbol(type, Decl(contextualTypeShouldBeLiteral.ts, 113, 12))

world: {
>world : Symbol(world, Decl(contextualTypeShouldBeLiteral.ts, 113, 30))

items: {
>items : Symbol(items, Decl(contextualTypeShouldBeLiteral.ts, 114, 12))

nested: { type: 'string' }
>nested : Symbol(nested, Decl(contextualTypeShouldBeLiteral.ts, 115, 14))
>type : Symbol(type, Decl(contextualTypeShouldBeLiteral.ts, 116, 17))
}
}
}
};

56 changes: 56 additions & 0 deletions tests/baselines/reference/contextualTypeShouldBeLiteral.types
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,59 @@ let xyz: LikeA | LikeB = {
xyz;
>xyz : LikeA

// Repro from #29168

interface TestObject {
type?: 'object';
>type : "object" | undefined

items: {
>items : { [k: string]: TestGeneric; }

[k: string]: TestGeneric;
>k : string

};
}

interface TestString {
type: 'string';
>type : "string"
}

type TestGeneric = (TestString | TestObject) & { [k: string]: any; };
>TestGeneric : TestGeneric
>k : string

const test: TestGeneric = {
>test : TestGeneric
>{ items: { hello: { type: 'string' }, world: { items: { nested: { type: 'string' } } } }} : { items: { hello: { type: "string"; }; world: { items: { nested: { type: "string"; }; }; }; }; }

items: {
>items : { hello: { type: "string"; }; world: { items: { nested: { type: "string"; }; }; }; }
>{ hello: { type: 'string' }, world: { items: { nested: { type: 'string' } } } } : { hello: { type: "string"; }; world: { items: { nested: { type: "string"; }; }; }; }

hello: { type: 'string' },
>hello : { type: "string"; }
>{ type: 'string' } : { type: "string"; }
>type : "string"
>'string' : "string"

world: {
>world : { items: { nested: { type: "string"; }; }; }
>{ items: { nested: { type: 'string' } } } : { items: { nested: { type: "string"; }; }; }

items: {
>items : { nested: { type: "string"; }; }
>{ nested: { type: 'string' } } : { nested: { type: "string"; }; }

nested: { type: 'string' }
>nested : { type: "string"; }
>{ type: 'string' } : { type: "string"; }
>type : "string"
>'string' : "string"
}
}
}
};

0 comments on commit 2ea0251

Please sign in to comment.