2014-09-12 22:35:07 +02:00
|
|
|
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.
|
|
|
|
|
|
|
|
|
2014-07-13 01:04:16 +02:00
|
|
|
==== 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;
|
|
|
|
~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2339: Property 'super' does not exist on type 'Sub1'.
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Case 2
|
|
|
|
class Base2 {
|
|
|
|
public foo() {
|
|
|
|
return "base";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class SubE2 extends Base2 {
|
|
|
|
public bar() {
|
|
|
|
return super.prototype.foo = null;
|
|
|
|
~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2339: Property 'prototype' does not exist on type 'Base2'.
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Case 3
|
|
|
|
class Base3 {
|
|
|
|
public foo() {
|
|
|
|
return "base";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class SubE3 extends Base3 {
|
|
|
|
public bar() {
|
|
|
|
return super.bar();
|
|
|
|
~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2339: Property 'bar' does not exist on type 'Base3'.
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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();
|
|
|
|
~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2335: 'super' can only be referenced in a derived class.
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|