我在手动创建的.d.ts文件中有这个TypeScript代码:
export interface IBeforeHook {
foo: Function,
bar: Function
}
export type BeforeHookCallbackMode = (h: IBeforeHook) => void;
export type BeforeHookRegularMode = (h?: IBeforeHook) => Promise<any>;
export type BeforeHookObservableMode = (h?: IBeforeHook) => Observable<any>;
export type BeforeHookSubscriberMode = (h?: IBeforeHook) => Subscriber<any>;
export type BeforeHookEEMode = (h?: IBeforeHook) => EventEmitter;
type TBeforeHookTemp =
BeforeHookCallbackMode |
BeforeHookRegularMode |
BeforeHookObservableMode |
BeforeHookSubscriberMode |
BeforeHookEEMode
我希望所有TBeforeHook类型都扩展/实现IBeforeHook接口......我该怎么做?
我想做类似的事情:
export type TBeforeHook extends TBeforeHookTemp implements IBeforeHook {
}
但这不起作用。