mirror of
https://github.com/swc-project/swc.git
synced 2024-12-27 15:42:51 +03:00
32 lines
609 B
TypeScript
32 lines
609 B
TypeScript
// derived class constructors must contain a super call
|
|
|
|
class Base {
|
|
x: string;
|
|
}
|
|
|
|
class Derived extends Base {
|
|
constructor() { // error
|
|
}
|
|
}
|
|
|
|
class Base2<T> {
|
|
x: T;
|
|
}
|
|
|
|
class Derived2<T> extends Base2<T> {
|
|
constructor() { // error for no super call (nested scopes don't count)
|
|
var r2 = () => super(); // error for misplaced super call (nested function)
|
|
}
|
|
}
|
|
|
|
class Derived3<T> extends Base2<T> {
|
|
constructor() { // error
|
|
var r = function () { super() } // error
|
|
}
|
|
}
|
|
|
|
class Derived4<T> extends Base2<T> {
|
|
constructor() {
|
|
var r = super(); // ok
|
|
}
|
|
} |