TypeScript/tests/baselines/reference/thisTypeErrors2.errors.txt
Nathan Shively-Sanders 67b9647069 Add a variable of type this in constructor body
The test already had a reference to the `this` value, but that doesn't
show that the *type* is allowed.
2015-11-02 10:47:56 -08:00

23 lines
953 B
Plaintext

tests/cases/conformance/types/thisType/thisTypeErrors2.ts(2,20): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
tests/cases/conformance/types/thisType/thisTypeErrors2.ts(9,38): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
==== tests/cases/conformance/types/thisType/thisTypeErrors2.ts (2 errors) ====
class Base {
constructor(a: this) {
~~~~
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
}
}
class Generic<T> {
}
class Derived {
n: number;
constructor(public host: Generic<this>) {
~~~~
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
let self: this = this;
this.n = 12;
}
}