21 lines
No EOL
1,012 B
Text
21 lines
No EOL
1,012 B
Text
tests/cases/compiler/thisInConstructorParameter2.ts(3,16): error TS2334: 'this' cannot be referenced in a static property initializer.
|
|
tests/cases/compiler/thisInConstructorParameter2.ts(5,28): error TS2333: 'this' cannot be referenced in constructor arguments.
|
|
tests/cases/compiler/thisInConstructorParameter2.ts(5,39): error TS2333: 'this' cannot be referenced in constructor arguments.
|
|
|
|
|
|
==== tests/cases/compiler/thisInConstructorParameter2.ts (3 errors) ====
|
|
class P {
|
|
x = this;
|
|
static y = this;
|
|
~~~~
|
|
!!! error TS2334: 'this' cannot be referenced in a static property initializer.
|
|
|
|
constructor(public z = this, zz = this) { }
|
|
~~~~
|
|
!!! error TS2333: 'this' cannot be referenced in constructor arguments.
|
|
~~~~
|
|
!!! error TS2333: 'this' cannot be referenced in constructor arguments.
|
|
|
|
foo(zz = this) { zz.x; }
|
|
static bar(zz = this) { zz.y; }
|
|
} |