File: voidOperatorWithStringType.types

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (172 lines) | stat: -rw-r--r-- 3,562 bytes parent folder | download | duplicates (7)
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
=== tests/cases/conformance/expressions/unaryOperators/voidOperator/voidOperatorWithStringType.ts ===
// void  operator on string type
var STRING: string;
>STRING : string

var STRING1: string[] = ["", "abc"];
>STRING1 : string[]
>["", "abc"] : string[]
>"" : ""
>"abc" : "abc"

function foo(): string { return "abc"; }
>foo : () => string
>"abc" : "abc"

class A {
>A : A

    public a: string;
>a : string

    static foo() { return ""; }
>foo : () => string
>"" : ""
}
module M {
>M : typeof M

    export var n: string;
>n : string
}

var objA = new A();
>objA : A
>new A() : A
>A : typeof A

// string type var
var ResultIsAny1 = void STRING;
>ResultIsAny1 : any
>void STRING : undefined
>STRING : string

var ResultIsAny2 = void STRING1;
>ResultIsAny2 : any
>void STRING1 : undefined
>STRING1 : string[]

// string type literal
var ResultIsAny3 = void "";
>ResultIsAny3 : any
>void "" : undefined
>"" : ""

var ResultIsAny4 = void { x: "", y: "" };
>ResultIsAny4 : any
>void { x: "", y: "" } : undefined
>{ x: "", y: "" } : { x: string; y: string; }
>x : string
>"" : ""
>y : string
>"" : ""

var ResultIsAny5 = void { x: "", y: (s: string) => { return s; } };
>ResultIsAny5 : any
>void { x: "", y: (s: string) => { return s; } } : undefined
>{ x: "", y: (s: string) => { return s; } } : { x: string; y: (s: string) => string; }
>x : string
>"" : ""
>y : (s: string) => string
>(s: string) => { return s; } : (s: string) => string
>s : string
>s : string

// string type expressions
var ResultIsAny6 = void objA.a;
>ResultIsAny6 : any
>void objA.a : undefined
>objA.a : string
>objA : A
>a : string

var ResultIsAny7 = void M.n;
>ResultIsAny7 : any
>void M.n : undefined
>M.n : string
>M : typeof M
>n : string

var ResultIsAny8 = void STRING1[0];
>ResultIsAny8 : any
>void STRING1[0] : undefined
>STRING1[0] : string
>STRING1 : string[]
>0 : 0

var ResultIsAny9 = void foo();
>ResultIsAny9 : any
>void foo() : undefined
>foo() : string
>foo : () => string

var ResultIsAny10 = void A.foo();
>ResultIsAny10 : any
>void A.foo() : undefined
>A.foo() : string
>A.foo : () => string
>A : typeof A
>foo : () => string

var ResultIsAny11 = void (STRING + STRING);
>ResultIsAny11 : any
>void (STRING + STRING) : undefined
>(STRING + STRING) : string
>STRING + STRING : string
>STRING : string
>STRING : string

var ResultIsAny12 = void STRING.charAt(0);
>ResultIsAny12 : any
>void STRING.charAt(0) : undefined
>STRING.charAt(0) : string
>STRING.charAt : (pos: number) => string
>STRING : string
>charAt : (pos: number) => string
>0 : 0

// multiple void  operators
var ResultIsAny13 = void void STRING;
>ResultIsAny13 : any
>void void STRING : undefined
>void STRING : undefined
>STRING : string

var ResultIsAny14 = void void void (STRING + STRING);
>ResultIsAny14 : any
>void void void (STRING + STRING) : undefined
>void void (STRING + STRING) : undefined
>void (STRING + STRING) : undefined
>(STRING + STRING) : string
>STRING + STRING : string
>STRING : string
>STRING : string

// miss assignment operators
void "";
>void "" : undefined
>"" : ""

void STRING;
>void STRING : undefined
>STRING : string

void STRING1;
>void STRING1 : undefined
>STRING1 : string[]

void foo();
>void foo() : undefined
>foo() : string
>foo : () => string

void objA.a,M.n;
>void objA.a,M.n : string
>void objA.a : undefined
>objA.a : string
>objA : A
>a : string
>M.n : string
>M : typeof M
>n : string