TypeScript/tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/constructorFunctionTypeIsAssignableToBaseType2.ts
2014-07-12 17:30:19 -07:00

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;
}
}