|
1 |
| -argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(3,10): error TS2815: 'arguments' cannot be referenced in property initializers. |
2 |
| -argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(9,10): error TS2815: 'arguments' cannot be referenced in property initializers. |
3 |
| -argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(15,15): error TS2815: 'arguments' cannot be referenced in property initializers. |
4 |
| -argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(21,15): error TS2815: 'arguments' cannot be referenced in property initializers. |
| 1 | +argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(3,10): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 2 | +argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(9,10): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 3 | +argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(15,15): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 4 | +argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(21,15): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 5 | +argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(33,16): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 6 | +argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(40,7): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 7 | +argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(42,16): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 8 | +argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(66,6): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later. |
| 9 | +argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(75,7): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 10 | +argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(77,9): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 11 | +argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(96,26): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 12 | +argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(102,15): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
5 | 13 |
|
6 | 14 |
|
7 |
| -==== argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts (4 errors) ==== |
| 15 | +==== argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts (12 errors) ==== |
8 | 16 | function A() {
|
9 | 17 | return class T {
|
10 | 18 | a = arguments
|
11 | 19 | ~~~~~~~~~
|
12 |
| -!!! error TS2815: 'arguments' cannot be referenced in property initializers. |
| 20 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
13 | 21 | }
|
14 | 22 | }
|
15 | 23 |
|
16 | 24 | function A1() {
|
17 | 25 | return new class T {
|
18 | 26 | a = arguments
|
19 | 27 | ~~~~~~~~~
|
20 |
| -!!! error TS2815: 'arguments' cannot be referenced in property initializers. |
| 28 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
21 | 29 | }
|
22 | 30 | }
|
23 | 31 |
|
24 | 32 | function B() {
|
25 | 33 | return class T {
|
26 | 34 | a = { b: arguments }
|
27 | 35 | ~~~~~~~~~
|
28 |
| -!!! error TS2815: 'arguments' cannot be referenced in property initializers. |
| 36 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
29 | 37 | }
|
30 | 38 | }
|
31 | 39 |
|
32 | 40 | function B1() {
|
33 | 41 | return new class T {
|
34 | 42 | a = { b: arguments }
|
35 | 43 | ~~~~~~~~~
|
36 |
| -!!! error TS2815: 'arguments' cannot be referenced in property initializers. |
| 44 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
37 | 45 | }
|
38 | 46 | }
|
39 | 47 |
|
40 | 48 | function C() {
|
41 | 49 | return class T {
|
42 | 50 | a = function () { arguments }
|
43 | 51 | }
|
44 |
| - } |
| 52 | + } |
| 53 | + |
| 54 | + function D() { |
| 55 | + return class T { |
| 56 | + a = () => arguments // should error |
| 57 | + ~~~~~~~~~ |
| 58 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 59 | + } |
| 60 | + } |
| 61 | + |
| 62 | + function D1() { |
| 63 | + return class T { |
| 64 | + a = () => { |
| 65 | + arguments; // should error |
| 66 | + ~~~~~~~~~ |
| 67 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 68 | + const b = () => { |
| 69 | + return arguments; // should error |
| 70 | + ~~~~~~~~~ |
| 71 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 72 | + } |
| 73 | + |
| 74 | + function f() { |
| 75 | + return arguments; // ok |
| 76 | + } |
| 77 | + } |
| 78 | + } |
| 79 | + } |
| 80 | + |
| 81 | + function D2() { |
| 82 | + return class { |
| 83 | + constructor() { |
| 84 | + arguments; // ok |
| 85 | + } |
| 86 | + get foo() { |
| 87 | + return arguments; // ok |
| 88 | + } |
| 89 | + set foo(foo: any) { |
| 90 | + arguments; // ok |
| 91 | + } |
| 92 | + bar() { |
| 93 | + arguments; // ok |
| 94 | + } |
| 95 | + [Symbol.iterator]() { |
| 96 | + ~~~~~~ |
| 97 | +!!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later. |
| 98 | + arguments; // ok |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | + |
| 103 | + function D3() { |
| 104 | + return class T { |
| 105 | + static { |
| 106 | + arguments; // should error |
| 107 | + ~~~~~~~~~ |
| 108 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 109 | + while(1) { |
| 110 | + arguments // should error |
| 111 | + ~~~~~~~~~ |
| 112 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 113 | + } |
| 114 | + } |
| 115 | + } |
| 116 | + } |
| 117 | + |
| 118 | + function D4() { |
| 119 | + return class T { |
| 120 | + static { |
| 121 | + function f() { |
| 122 | + arguments; // ok |
| 123 | + } |
| 124 | + } |
| 125 | + } |
| 126 | + } |
| 127 | + |
| 128 | + |
| 129 | + function D5() { |
| 130 | + return class T { |
| 131 | + a = (() => { return arguments; })() // should error |
| 132 | + ~~~~~~~~~ |
| 133 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 134 | + } |
| 135 | + } |
| 136 | + |
| 137 | + function D6() { |
| 138 | + return class T { |
| 139 | + a = (x = arguments) => {} // should error |
| 140 | + ~~~~~~~~~ |
| 141 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization blocks. |
| 142 | + } |
| 143 | + } |
| 144 | + |
| 145 | + function D7() { |
| 146 | + return class T { |
| 147 | + a(x = arguments){ // ok |
| 148 | + |
| 149 | + } |
| 150 | + } |
| 151 | + } |
| 152 | + |
0 commit comments