32 lines
No EOL
545 B
TypeScript
32 lines
No EOL
545 B
TypeScript
// the constructor function itself does not need to be a subtype of the base type constructor function
|
|
|
|
class Base {
|
|
static foo: {
|
|
bar: Object;
|
|
}
|
|
constructor(x: Object) {
|
|
}
|
|
}
|
|
|
|
class Derived extends Base {
|
|
// ok
|
|
static foo: {
|
|
bar: number;
|
|
}
|
|
|
|
constructor(x: number) {
|
|
super(x);
|
|
}
|
|
}
|
|
|
|
class Derived2 extends Base {
|
|
static foo: {
|
|
bar: number;
|
|
}
|
|
|
|
// ok, not enforcing assignability relation on this
|
|
constructor(x: any) {
|
|
super(x);
|
|
return 1;
|
|
}
|
|
} |