3
我有這樣的打字稿代碼手動創建.d.ts文件中的函數:聲明實現接口
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 {
}
,但不起作用。
非常好的非常感謝你 –