37 lines
No EOL
1.3 KiB
Text
37 lines
No EOL
1.3 KiB
Text
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(14,15): error TS2332: 'this' cannot be referenced in current location.
|
|
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(20,21): error TS2332: 'this' cannot be referenced in current location.
|
|
|
|
|
|
==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts (2 errors) ====
|
|
class Base {
|
|
x: string;
|
|
constructor(a) { }
|
|
}
|
|
|
|
class Derived extends Base {
|
|
constructor() {
|
|
super(this); // ok
|
|
}
|
|
}
|
|
|
|
class Derived2 extends Base {
|
|
constructor(public a: string) {
|
|
super(this); // error
|
|
~~~~
|
|
!!! error TS2332: 'this' cannot be referenced in current location.
|
|
}
|
|
}
|
|
|
|
class Derived3 extends Base {
|
|
constructor(public a: string) {
|
|
super(() => this); // error
|
|
~~~~
|
|
!!! error TS2332: 'this' cannot be referenced in current location.
|
|
}
|
|
}
|
|
|
|
class Derived4 extends Base {
|
|
constructor(public a: string) {
|
|
super(function () { return this; }); // ok
|
|
}
|
|
} |