|
|
|
|
@@ -1,109 +1,109 @@
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(1,9): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(2,14): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(3,9): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(5,16): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(5,23): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(6,12): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(11,13): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(12,14): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(13,18): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(14,23): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(15,15): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(15,22): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(19,13): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(20,14): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(21,18): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(22,23): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(23,15): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(23,22): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(27,15): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(28,17): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(29,19): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(29,26): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(35,19): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(1,9): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(2,14): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(3,9): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(5,16): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(5,23): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(6,12): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(11,13): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(12,14): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(13,18): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(14,23): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(15,15): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(15,22): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(19,13): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(20,14): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(21,18): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(22,23): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(23,15): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(23,22): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(27,15): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(28,17): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(29,19): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(29,26): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(35,19): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(36,20): error TS2331: 'this' cannot be referenced in a module or namespace body.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(41,14): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(41,21): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(46,23): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(46,30): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(50,18): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(50,25): error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(41,14): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(41,21): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(46,23): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(46,30): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(50,18): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
tests/cases/conformance/types/thisType/thisTypeErrors.ts(50,25): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
==== tests/cases/conformance/types/thisType/thisTypeErrors.ts (30 errors) ====
|
|
|
|
|
var x1: this;
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
var x2: { a: this };
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
var x3: this[];
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
|
|
|
|
|
function f1(x: this): this {
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
var y: this;
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface I1 {
|
|
|
|
|
a: { x: this };
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
b: { (): this };
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
c: { new (): this };
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
d: { [x: string]: this };
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
e: { f(x: this): this };
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class C1 {
|
|
|
|
|
a: { x: this };
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
b: { (): this };
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
c: { new (): this };
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
d: { [x: string]: this };
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
e: { f(x: this): this };
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class C2 {
|
|
|
|
|
static x: this;
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
static y = <this>undefined;
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
static foo(x: this): this {
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -111,7 +111,7 @@ tests/cases/conformance/types/thisType/thisTypeErrors.ts(50,25): error TS2526: '
|
|
|
|
|
namespace N1 {
|
|
|
|
|
export var x: this;
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
export var y = this;
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2331: 'this' cannot be referenced in a module or namespace body.
|
|
|
|
|
@@ -121,26 +121,26 @@ tests/cases/conformance/types/thisType/thisTypeErrors.ts(50,25): error TS2526: '
|
|
|
|
|
x1 = {
|
|
|
|
|
g(x: this): this {
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
f() {
|
|
|
|
|
function g(x: this): this {
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
let x2 = {
|
|
|
|
|
h(x: this): this {
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
~~~~
|
|
|
|
|
!!! error TS2526: 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|