File: unusedLocalsAndParametersDeferred.errors.txt

package info (click to toggle)
node-typescript 4.8.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 523,068 kB
  • sloc: javascript: 1,735,777; makefile: 7; sh: 1
file content (171 lines) | stat: -rw-r--r-- 3,743 bytes parent folder | download | duplicates (4)
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
tests/cases/compiler/unusedLocalsAndParametersDeferred.ts(41,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/unusedLocalsAndParametersDeferred.ts(64,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/unusedLocalsAndParametersDeferred.ts(86,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.


==== tests/cases/compiler/unusedLocalsAndParametersDeferred.ts (3 errors) ====
    export { };
    
    function defered<T>(a: () => T): T {
        return a();
    }
    
    // function declaration paramter
    function f(a) {
        defered(() => {
            a;
        });
    }
    f(0);
    
    // function expression paramter
    var fexp = function (a) {
        defered(() => {
            a;
        });
    };
    fexp(1);
    
    // arrow function paramter
    var farrow = (a) => {
        defered(() => {
            a;
        });
    };
    farrow(2);
    
    let prop1;
    
    class C {
        // Method declaration paramter
        method(a) {
            defered(() => {
                a;
            });
        }
        // Accessor declaration paramter
        set x(v: number) {
            ~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
            defered(() => {
                v;
            });
        }
        // in a property initalizer
        p = defered(() => {
            prop1;
        });
    }
    
    new C();
    
    let prop2;
    
    var E = class {
        // Method declaration paramter
        method(a) {
            defered(() => {
                a;
            });
        }
        // Accessor declaration paramter
        set x(v: number) {
            ~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
            defered(() => {
                v;
            });
        }
        // in a property initalizer
        p = defered(() => {
            prop2;
        });
    }
    
    new E();
    
    
    var o = {
        // Object literal method declaration paramter
        method(a) {
            defered(() => {
                a;
            });
        },
        // Accessor declaration paramter
        set x(v: number) {
            ~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
            defered(() => {
                v;
            });
        },
        // in a property initalizer
        p: defered(() => {
            prop1;
        })
    };
    
    o;
    
    // in a for..in statment
    for (let i in o) {
        defered(() => {
            i;
        });
    }
    
    // in a for..of statment
    for (let i of [1,2,3]) {
        defered(() => {
            i;
        });
    }
    
    // in a for. statment
    for (let i = 0; i < 10; i++) {
        defered(() => {
            i;
        });
    }
    
    // in a block
    
    const condition = false;
    if (condition) {
        const c = 0;
        defered(() => {
            c;
        });
    }
    
    // in try/catch/finally
    try {
        const a = 0;
        defered(() => {
            a;
        });
    }
    catch (e) {
        const c = 1;
        defered(() => {
            c;
        });
    }
    finally {
        const c = 0;
        defered(() => {
            c;
        });
    }
    
    
    // in a namespace
    namespace N {
        var x;
        defered(() => {
            x;
        });
    }
    N;