81 lines
No EOL
2 KiB
Text
81 lines
No EOL
2 KiB
Text
tests/cases/compiler/super1.ts(16,22): error TS2339: Property 'super' does not exist on type 'Sub1'.
|
|
tests/cases/compiler/super1.ts(29,22): error TS2339: Property 'prototype' does not exist on type 'Base2'.
|
|
tests/cases/compiler/super1.ts(42,22): error TS2339: Property 'bar' does not exist on type 'Base3'.
|
|
tests/cases/compiler/super1.ts(62,20): error TS2335: 'super' can only be referenced in a derived class.
|
|
|
|
|
|
==== tests/cases/compiler/super1.ts (4 errors) ====
|
|
// Case 1
|
|
class Base1 {
|
|
public foo() {
|
|
return "base";
|
|
}
|
|
}
|
|
|
|
class Sub1 extends Base1 {
|
|
public bar() {
|
|
return "base";
|
|
}
|
|
}
|
|
|
|
class SubSub1 extends Sub1 {
|
|
public bar() {
|
|
return super.super.foo;
|
|
~~~~~
|
|
!!! error TS2339: Property 'super' does not exist on type 'Sub1'.
|
|
}
|
|
}
|
|
|
|
// Case 2
|
|
class Base2 {
|
|
public foo() {
|
|
return "base";
|
|
}
|
|
}
|
|
|
|
class SubE2 extends Base2 {
|
|
public bar() {
|
|
return super.prototype.foo = null;
|
|
~~~~~~~~~
|
|
!!! error TS2339: Property 'prototype' does not exist on type 'Base2'.
|
|
}
|
|
}
|
|
|
|
// Case 3
|
|
class Base3 {
|
|
public foo() {
|
|
return "base";
|
|
}
|
|
}
|
|
|
|
class SubE3 extends Base3 {
|
|
public bar() {
|
|
return super.bar();
|
|
~~~
|
|
!!! error TS2339: Property 'bar' does not exist on type 'Base3'.
|
|
}
|
|
}
|
|
|
|
// Case 4
|
|
module Base4 {
|
|
class Sub4 {
|
|
public x(){
|
|
return "hello";
|
|
}
|
|
}
|
|
|
|
export class SubSub4 extends Sub4{
|
|
public x(){
|
|
return super.x();
|
|
}
|
|
}
|
|
|
|
export class Sub4E {
|
|
public x() {
|
|
return super.x();
|
|
~~~~~
|
|
!!! error TS2335: 'super' can only be referenced in a derived class.
|
|
}
|
|
}
|
|
}
|
|
|