interface Task { (): Promise; } type Deconstruction any> = ReturnType extends Promise ? U : ReturnType; interface TaskConfig { taskId: string; handlePromise: Task; resolve: (value: Deconstruction) => void; reject: (reason: any) => void; } interface ConcurrentLimitInterface { limitCount: number; queue: Array Promise>>; run: Promise>(task: T, taskId: string) => Promise>; } interface Params { limitCount: number; } declare class ConcurrentLimit implements ConcurrentLimitInterface { limitCount: number; queue: Array>; runningCount: number; skipTasks: Set; constructor(config: Params); private enqueue; private next; skip(taskId: string): void; run Promise>(task: T, taskId: string): Promise>; } export { ConcurrentLimit };