2014-11-15 00:44:06 +01:00
|
|
|
=== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentES6.ts ===
|
|
|
|
var id: number = 10000;
|
2015-04-13 23:01:57 +02:00
|
|
|
>id : number, Symbol(id, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 0, 3))
|
2015-04-13 21:36:11 +02:00
|
|
|
>10000 : number
|
2014-11-15 00:44:06 +01:00
|
|
|
|
|
|
|
var name: string = "my name";
|
2015-04-13 23:01:57 +02:00
|
|
|
>name : string, Symbol(name, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 1, 3))
|
2015-04-13 21:36:11 +02:00
|
|
|
>"my name" : string
|
2014-11-15 00:44:06 +01:00
|
|
|
|
|
|
|
var person: { name: string; id: number } = { name, id };
|
2015-04-13 23:01:57 +02:00
|
|
|
>person : { name: string; id: number; }, Symbol(person, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 3, 3))
|
|
|
|
>name : string, Symbol(name, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 3, 13))
|
|
|
|
>id : number, Symbol(id, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 3, 27))
|
2014-11-15 00:44:06 +01:00
|
|
|
>{ name, id } : { name: string; id: number; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>name : string, Symbol(name, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 3, 44))
|
|
|
|
>id : number, Symbol(id, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 3, 50))
|
2014-11-15 00:44:06 +01:00
|
|
|
|
|
|
|
function foo(obj: { name: string }): void { };
|
2015-04-13 23:01:57 +02:00
|
|
|
>foo : (obj: { name: string; }) => void, Symbol(foo, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 3, 56))
|
|
|
|
>obj : { name: string; }, Symbol(obj, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 4, 13))
|
|
|
|
>name : string, Symbol(name, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 4, 19))
|
2014-11-15 00:44:06 +01:00
|
|
|
|
|
|
|
function bar(name: string, id: number) { return { name, id }; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>bar : (name: string, id: number) => { name: string; id: number; }, Symbol(bar, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 4, 46))
|
|
|
|
>name : string, Symbol(name, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 5, 13))
|
|
|
|
>id : number, Symbol(id, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 5, 26))
|
2014-11-15 00:44:06 +01:00
|
|
|
>{ name, id } : { name: string; id: number; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>name : string, Symbol(name, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 5, 49))
|
|
|
|
>id : number, Symbol(id, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 5, 55))
|
2014-11-15 00:44:06 +01:00
|
|
|
|
|
|
|
function bar1(name: string, id: number) { return { name }; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>bar1 : (name: string, id: number) => { name: string; }, Symbol(bar1, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 5, 63))
|
|
|
|
>name : string, Symbol(name, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 6, 14))
|
|
|
|
>id : number, Symbol(id, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 6, 27))
|
2014-11-15 00:44:06 +01:00
|
|
|
>{ name } : { name: string; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>name : string, Symbol(name, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 6, 50))
|
2014-11-15 00:44:06 +01:00
|
|
|
|
|
|
|
function baz(name: string, id: number): { name: string; id: number } { return { name, id }; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>baz : (name: string, id: number) => { name: string; id: number; }, Symbol(baz, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 6, 60))
|
|
|
|
>name : string, Symbol(name, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 7, 13))
|
|
|
|
>id : number, Symbol(id, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 7, 26))
|
|
|
|
>name : string, Symbol(name, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 7, 41))
|
|
|
|
>id : number, Symbol(id, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 7, 55))
|
2014-11-15 00:44:06 +01:00
|
|
|
>{ name, id } : { name: string; id: number; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>name : string, Symbol(name, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 7, 79))
|
|
|
|
>id : number, Symbol(id, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 7, 85))
|
2014-11-15 00:44:06 +01:00
|
|
|
|
|
|
|
foo(person);
|
|
|
|
>foo(person) : void
|
2015-04-13 23:01:57 +02:00
|
|
|
>foo : (obj: { name: string; }) => void, Symbol(foo, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 3, 56))
|
|
|
|
>person : { name: string; id: number; }, Symbol(person, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 3, 3))
|
2014-11-15 00:44:06 +01:00
|
|
|
|
|
|
|
var person1 = bar("Hello", 5);
|
2015-04-13 23:01:57 +02:00
|
|
|
>person1 : { name: string; id: number; }, Symbol(person1, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 10, 3))
|
2014-11-15 00:44:06 +01:00
|
|
|
>bar("Hello", 5) : { name: string; id: number; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>bar : (name: string, id: number) => { name: string; id: number; }, Symbol(bar, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 4, 46))
|
2015-04-13 21:36:11 +02:00
|
|
|
>"Hello" : string
|
|
|
|
>5 : number
|
2014-11-15 00:44:06 +01:00
|
|
|
|
|
|
|
var person2: { name: string } = bar("Hello", 5);
|
2015-04-13 23:01:57 +02:00
|
|
|
>person2 : { name: string; }, Symbol(person2, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 11, 3))
|
|
|
|
>name : string, Symbol(name, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 11, 14))
|
2014-11-15 00:44:06 +01:00
|
|
|
>bar("Hello", 5) : { name: string; id: number; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>bar : (name: string, id: number) => { name: string; id: number; }, Symbol(bar, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 4, 46))
|
2015-04-13 21:36:11 +02:00
|
|
|
>"Hello" : string
|
|
|
|
>5 : number
|
2014-11-15 00:44:06 +01:00
|
|
|
|
|
|
|
var person3: { name: string; id: number } = bar("Hello", 5);
|
2015-04-13 23:01:57 +02:00
|
|
|
>person3 : { name: string; id: number; }, Symbol(person3, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 12, 3))
|
|
|
|
>name : string, Symbol(name, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 12, 14))
|
|
|
|
>id : number, Symbol(id, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 12, 28))
|
2014-11-15 00:44:06 +01:00
|
|
|
>bar("Hello", 5) : { name: string; id: number; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>bar : (name: string, id: number) => { name: string; id: number; }, Symbol(bar, Decl(objectLiteralShorthandPropertiesAssignmentES6.ts, 4, 46))
|
2015-04-13 21:36:11 +02:00
|
|
|
>"Hello" : string
|
|
|
|
>5 : number
|
2014-11-15 00:44:06 +01:00
|
|
|
|