Since it is Polymorphic in TypeScript 1.7, as I discovered here , we can define a method in a class with a return type this, and automatically, any classes that extend this class and inherit methods will have return types corresponding to their type this. For example:
class Model {
save():this {
}
}
class SomeModel extends Model {
}
However, I need to have an inherited method staticwith a return type that references the class itself. This is best described in the code:
class Model {
static getAll():Model[] {
}
save():this {
}
}
class SomeModel extends Model {
}
I may have to think of another way to implement this, since Polymorphic thisin TypeScript 1.7 does not support design staticby design.
EDIT. , , Github : https://github.com/Microsoft/TypeScript/issues/5863 p >