diff --git a/tests/baselines/reference/thisTypeErrors2.errors.txt b/tests/baselines/reference/thisTypeErrors2.errors.txt new file mode 100644 index 00000000000..cdb49b877df --- /dev/null +++ b/tests/baselines/reference/thisTypeErrors2.errors.txt @@ -0,0 +1,22 @@ +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 { + } + class Derived { + n: number; + constructor(public host: Generic) { + ~~~~ +!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. + this.n = 12; + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/thisTypeErrors2.js b/tests/baselines/reference/thisTypeErrors2.js new file mode 100644 index 00000000000..476e2039996 --- /dev/null +++ b/tests/baselines/reference/thisTypeErrors2.js @@ -0,0 +1,33 @@ +//// [thisTypeErrors2.ts] +class Base { + constructor(a: this) { + } +} +class Generic { +} +class Derived { + n: number; + constructor(public host: Generic) { + this.n = 12; + } +} + + +//// [thisTypeErrors2.js] +var Base = (function () { + function Base(a) { + } + return Base; +})(); +var Generic = (function () { + function Generic() { + } + return Generic; +})(); +var Derived = (function () { + function Derived(host) { + this.host = host; + this.n = 12; + } + return Derived; +})(); diff --git a/tests/cases/conformance/types/thisType/thisTypeErrors2.ts b/tests/cases/conformance/types/thisType/thisTypeErrors2.ts new file mode 100644 index 00000000000..b30a554bd88 --- /dev/null +++ b/tests/cases/conformance/types/thisType/thisTypeErrors2.ts @@ -0,0 +1,12 @@ +class Base { + constructor(a: this) { + } +} +class Generic { +} +class Derived { + n: number; + constructor(public host: Generic) { + this.n = 12; + } +}