I have a typescript question here.
I have many model classes, that are all inherited from BaseModel
class BaseModel {
public isChecked: boolean;
}
class Animal extends BaseModel {
public id: number;
}
class Car extends BaseModel {
public hasHotWheels: boolean;
}
Now I need to write a function that accepts arguments that are classes that inherit from the BaseModel. I can explicitly list all the classes, but I have more than 50 models that inherit from the BaseModel class, so my question is, can I somehow state that I expect the function parameter to inherit from a said class like so
function foo( _input: inherits from BaseModel ) {}