43 lines
No EOL
920 B
Text
43 lines
No EOL
920 B
Text
tests/cases/compiler/super.ts(29,9): error TS2335: 'super' can only be referenced in a derived class.
|
|
|
|
|
|
==== tests/cases/compiler/super.ts (1 errors) ====
|
|
class Base {
|
|
constructor() {
|
|
var x;
|
|
}
|
|
public foo() {
|
|
return "base";
|
|
}
|
|
|
|
public bar() {
|
|
return "basebar";
|
|
}
|
|
}
|
|
|
|
class Sub1 extends Base {
|
|
public foo() {
|
|
return "sub1" + super.foo() + super.bar();
|
|
}
|
|
}
|
|
|
|
|
|
class SubSub1 extends Sub1 {
|
|
public foo() {
|
|
return "subsub1" + super.foo();
|
|
}
|
|
}
|
|
|
|
class Base2 {
|
|
public foo() {
|
|
super.foo();
|
|
~~~~~
|
|
!!! error TS2335: 'super' can only be referenced in a derived class.
|
|
}
|
|
}
|
|
|
|
var s = new Sub1();
|
|
var ss = new SubSub1();
|
|
s.foo() + ss.foo();
|
|
|
|
|