1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
=== tests/cases/compiler/objectCreate.ts ===
declare var union: null | { a: number, b: string };
>union : { a: number; b: string; } | null
>null : null
>a : number
>b : string
var n = Object.create(null); // object
>n : any
>Object.create(null) : any
>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>Object : ObjectConstructor
>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>null : null
var t = Object.create({ a: 1, b: "" }); // {a: number, b: string }
>t : any
>Object.create({ a: 1, b: "" }) : any
>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>Object : ObjectConstructor
>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>{ a: 1, b: "" } : { a: number; b: string; }
>a : number
>1 : 1
>b : string
>"" : ""
var u = Object.create(union); // object | {a: number, b: string }
>u : any
>Object.create(union) : any
>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>Object : ObjectConstructor
>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>union : { a: number; b: string; } | null
var e = Object.create({}); // {}
>e : any
>Object.create({}) : any
>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>Object : ObjectConstructor
>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>{} : {}
var o = Object.create(<object>{}); // object
>o : any
>Object.create(<object>{}) : any
>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>Object : ObjectConstructor
>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
><object>{} : object
>{} : {}
var a = Object.create(null, {}); // any
>a : any
>Object.create(null, {}) : any
>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>Object : ObjectConstructor
>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>null : null
>{} : {}
var a = Object.create({ a: 1, b: "" }, {});
>a : any
>Object.create({ a: 1, b: "" }, {}) : any
>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>Object : ObjectConstructor
>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>{ a: 1, b: "" } : { a: number; b: string; }
>a : number
>1 : 1
>b : string
>"" : ""
>{} : {}
var a = Object.create(union, {});
>a : any
>Object.create(union, {}) : any
>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>Object : ObjectConstructor
>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>union : { a: number; b: string; } | null
>{} : {}
var a = Object.create({}, {});
>a : any
>Object.create({}, {}) : any
>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>Object : ObjectConstructor
>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>{} : {}
>{} : {}
var a = Object.create(<object>{}, {});
>a : any
>Object.create(<object>{}, {}) : any
>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
>Object : ObjectConstructor
>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any; }
><object>{} : object
>{} : {}
>{} : {}
|