interface Queue<Task, Wrapper = DefaultWrapper<unknown>> {
push<T>(...tasks: Task[]): Wrapper<void>;
delete(phone: string): Wrapper<number>;
shift(): Wrapper<Task | undefined>;
}
или такое?: export interface NotPromise { }; export interface Queue<Task, Wrapper extends NotPromise = NotPromise> { push<T>(...tasks: Task[]): Wrapper extends NotPromise ? void : Promise<void>; delete(phone: string): Wrapper extends NotPromise ? number : Promise<number>; shift(): Wrapper extends NotPromise ? Task | undefined : Promise<Task | undefined>; }
Обсуждают сегодня