Skip to content

Commit

Permalink
Fix add(All) parameter type
Browse files Browse the repository at this point in the history
add and addAll don't take Promise directly, but a function that once called returns a promise
  • Loading branch information
draperunner committed Sep 11, 2020
1 parent 4395ff7 commit 0843fdf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ export interface QueueOptions {
signal?: AbortSignal
}

type PromiseCreator<T> = () => Promise<T>

export default class PromiseThrottle {
constructor(options: ThrottleOptions)
add<T>(promise: Promise<T>, opts?: QueueOptions): Promise<T>
addAll<T>(promises: Promise<T>[], opts?: QueueOptions): Promise<T[]>
add<T>(promiseCreator: PromiseCreator<T>, opts?: QueueOptions): Promise<T>
addAll<T>(promisesCreators: PromiseCreator<T>[], opts?: QueueOptions): Promise<T[]>
}

0 comments on commit 0843fdf

Please sign in to comment.