File: ambientConstLiterals.types

package info (click to toggle)
node-typescript 2.1.5-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 203,960 kB
  • sloc: sh: 11; makefile: 5
file content (105 lines) | stat: -rw-r--r-- 1,631 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
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
103
104
105
=== tests/cases/compiler/ambientConstLiterals.ts ===

function f<T>(x: T): T {
>f : <T>(x: T) => T
>T : T
>x : T
>T : T
>T : T

    return x;
>x : T
}

enum E { A, B, C }
>E : E
>A : E.A
>B : E.B
>C : E.C

const c1 = "abc";
>c1 : "abc"
>"abc" : "abc"

const c2 = 123;
>c2 : 123
>123 : 123

const c3 = c1;
>c3 : "abc"
>c1 : "abc"

const c4 = c2;
>c4 : 123
>c2 : 123

const c5 = f(123);
>c5 : 123
>f(123) : 123
>f : <T>(x: T) => T
>123 : 123

const c6 = f(-123);
>c6 : -123
>f(-123) : -123
>f : <T>(x: T) => T
>-123 : -123
>123 : 123

const c7 = true;
>c7 : true
>true : true

const c8 = E.A;
>c8 : E.A
>E.A : E.A
>E : typeof E
>A : E.A

const c9 = { x: "abc" };
>c9 : { x: string; }
>{ x: "abc" } : { x: string; }
>x : string
>"abc" : "abc"

const c10 = [123];
>c10 : number[]
>[123] : number[]
>123 : 123

const c11 = "abc" + "def";
>c11 : string
>"abc" + "def" : string
>"abc" : "abc"
>"def" : "def"

const c12 = 123 + 456;
>c12 : number
>123 + 456 : number
>123 : 123
>456 : 456

const c13 = Math.random() > 0.5 ? "abc" : "def";
>c13 : "abc" | "def"
>Math.random() > 0.5 ? "abc" : "def" : "abc" | "def"
>Math.random() > 0.5 : boolean
>Math.random() : number
>Math.random : () => number
>Math : Math
>random : () => number
>0.5 : 0.5
>"abc" : "abc"
>"def" : "def"

const c14 = Math.random() > 0.5 ? 123 : 456;
>c14 : 123 | 456
>Math.random() > 0.5 ? 123 : 456 : 123 | 456
>Math.random() > 0.5 : boolean
>Math.random() : number
>Math.random : () => number
>Math : Math
>random : () => number
>0.5 : 0.5
>123 : 123
>456 : 456