How can I specify the return type of an interface method to be an instance of the class implementing the interface in TypeScript? For example:
interface Entity {
save: () => ClassThatImplementsEntity
}
so that a class implementing Entity interface will have a save method that returns instance of that class
class User implements Entity {
save() {
// some logic
return this;
}
}