Can You Specify Multiple Type Constraints For TypeScript Generics
Typescript doesn't offer a syntax to get multiple inheritance for generic types. However, you can achieve similar semantics by using the Union types and Intersection types. In your case, you want an intersection :
interface Example<T extends MyClass & OtherClass> {}
For a Union of both types :
interface Example<T extends MyClass | OtherClass> {}
A work around for this would be to use a super-interface (which also answers the question "why would you allow an interface to inherit from a class").
interface ISuperInterface extends MyClass, OtherClass {
}
export interface IExample<T extends ISuperInterface> {
getById(id: number): T;
}