1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
tests/cases/compiler/superInLambdas.ts(47,49): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
tests/cases/compiler/superInLambdas.ts(51,49): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
tests/cases/compiler/superInLambdas.ts(61,34): error TS1034: 'super' must be followed by an argument list or member access.
tests/cases/compiler/superInLambdas.ts(65,34): error TS1034: 'super' must be followed by an argument list or member access.
==== tests/cases/compiler/superInLambdas.ts (4 errors) ====
class User {
name: string = "Bob";
sayHello(): void {
//console.log("Hello, " + this.name);
}
}
class RegisteredUser extends User {
name: string = "Frank";
constructor() {
super();
// super call in a constructor
super.sayHello();
// super call in a lambda in a constructor
var x = () => super.sayHello();
}
sayHello(): void {
// super call in a method
super.sayHello();
// super call in a lambda in a method
var x = () => super.sayHello();
}
}
class RegisteredUser2 extends User {
name: string = "Joe";
constructor() {
super();
// super call in a nested lambda in a constructor
var x = () => () => () => super.sayHello();
}
sayHello(): void {
// super call in a nested lambda in a method
var x = () => () => () => super.sayHello();
}
}
class RegisteredUser3 extends User {
name: string = "Sam";
constructor() {
super();
// super property in a nested lambda in a constructor
var superName = () => () => () => super.name;
~~~~
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
}
sayHello(): void {
// super property in a nested lambda in a method
var superName = () => () => () => super.name;
~~~~
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
}
}
class RegisteredUser4 extends User {
name: string = "Mark";
constructor() {
super();
// super in a nested lambda in a constructor
var x = () => () => super;
~
!!! error TS1034: 'super' must be followed by an argument list or member access.
}
sayHello(): void {
// super in a nested lambda in a method
var x = () => () => super;
~
!!! error TS1034: 'super' must be followed by an argument list or member access.
}
}
|