Typescript How To Declare A Subclass Type?
Is it possible to have something like this? export abstract class FilterBoxElement { abstract getEntities: any; } export interface FilterBoxControlSuggestions extends FilterBox
Solution 1:
You could do it with a union type:
export interface FilterBoxDataProps {
controlElement: FilterBoxControlSuggestions | FilterBoxControlDropDown
}
Or with generics if you want all subclasses of FilterBoxElement:
export interface FilterBoxDataProps<T extendsFilterBoxElement> {
controlElement: T
}
Post a Comment for "Typescript How To Declare A Subclass Type?"