TypeScript/tests/baselines/reference/thisInConstructorParameter2.errors.txt

21 lines
1,012 B
Plaintext
Raw Normal View History

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;
~~~~
!!! 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) { }
~~~~
!!! error TS2333: 'this' cannot be referenced in constructor arguments.
2014-07-13 01:04:16 +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; }
}