TypeScript/tests/baselines/reference/thisInOuterClassBody.errors.txt
2014-09-11 16:11:08 -07:00

27 lines
761 B
Plaintext

==== tests/cases/compiler/thisInOuterClassBody.ts (3 errors) ====
class Foo {
x = this;
static y = this;
~~~~
!!! error TS2334: 'this' cannot be referenced in a static property initializer.
bar() {
this.x; // 'this' is type 'Foo'
var f = () => this.x; // 'this' should be type 'Foo' as well
var p = this.y;
~
!!! error TS2339: Property 'y' does not exist on type 'Foo'.
return this;
}
static bar2() {
var a = this.y;
var b = this.x;
~
!!! error TS2339: Property 'x' does not exist on type 'typeof Foo'.
}
}