File: useObjectValuesAndEntries1.types

package info (click to toggle)
node-typescript 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 203,952 kB
  • ctags: 52,987
  • sloc: sh: 11; makefile: 5
file content (59 lines) | stat: -rw-r--r-- 2,119 bytes parent folder | download | duplicates (2)
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
=== tests/cases/conformance/es2017/useObjectValuesAndEntries1.ts ===

var o = { a: 1, b: 2 };
>o : { a: number; b: number; }
>{ a: 1, b: 2 } : { a: number; b: number; }
>a : number
>1 : 1
>b : number
>2 : 2

for (var x of Object.values(o)) {
>x : number
>Object.values(o) : number[]
>Object.values : { <T>(o: { [s: string]: T; }): T[]; (o: any): any[]; }
>Object : ObjectConstructor
>values : { <T>(o: { [s: string]: T; }): T[]; (o: any): any[]; }
>o : { a: number; b: number; }

    let y = x;
>y : number
>x : number
}

var entries = Object.entries(o);  // <-- entries: ['a' | 'b', number][]
>entries : [string, number][]
>Object.entries(o) : [string, number][]
>Object.entries : { <T>(o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; }
>Object : ObjectConstructor
>entries : { <T>(o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; }
>o : { a: number; b: number; }

var entries1 = Object.entries(1); // <-- entries: [string, any][]
>entries1 : [string, any][]
>Object.entries(1) : [string, any][]
>Object.entries : { <T>(o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; }
>Object : ObjectConstructor
>entries : { <T>(o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; }
>1 : 1

var entries2 = Object.entries({a: true, b: 2}) // ['a' | 'b', number | boolean][]
>entries2 : [string, number | boolean][]
>Object.entries({a: true, b: 2}) : [string, number | boolean][]
>Object.entries : { <T>(o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; }
>Object : ObjectConstructor
>entries : { <T>(o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; }
>{a: true, b: 2} : { a: true; b: 2; }
>a : boolean
>true : true
>b : number
>2 : 2

var entries3 = Object.entries({}) // [never, any][]
>entries3 : [string, {}][]
>Object.entries({}) : [string, {}][]
>Object.entries : { <T>(o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; }
>Object : ObjectConstructor
>entries : { <T>(o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; }
>{} : {}