有可能有这样的东西吗?
export abstract class FilterBoxElement {
abstract getEntities: any;
}
export interface FilterBoxControlSuggestions extends FilterBoxElement {
getEntities: // some implementation with different parameters
}
export interface FilterBoxControlDropDown extends FilterBoxElement {
getEntities: // some implementation with different parameters
}
export interface FilterBoxDataProps {
controlElement: FilterBoxElement // FilterBoxControlSuggestions or FilterBoxControlDropDown
}
我希望它controlElement
必须是 aFilterBoxControlSuggestions
或 a FilterBoxControlDropDown
。但现在我可以把所有东西都放进去。有没有办法实现这一目标?