2014-09-12 22:35:07 +02:00
|
|
|
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.
|
|
|
|
|
|
|
|
|
2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/thisInConstructorParameter2.ts (3 errors) ====
|
|
|
|
class P {
|
|
|
|
x = this;
|
|
|
|
static y = this;
|
|
|
|
~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2334: 'this' cannot be referenced in a static property initializer.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
constructor(public z = this, zz = this) { }
|
|
|
|
~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2333: 'this' cannot be referenced in constructor arguments.
|
2014-07-13 01:04:16 +02:00
|
|
|
~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2333: 'this' cannot be referenced in constructor arguments.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
foo(zz = this) { zz.x; }
|
|
|
|
static bar(zz = this) { zz.y; }
|
|
|
|
}
|