Skip to content

Commit

Permalink
feat(AsyncQueue): generic type for push method
Browse files Browse the repository at this point in the history
  • Loading branch information
alimd committed Jan 8, 2024
1 parent 5bbfd31 commit aec6710
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/async-queue/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class AsyncQueue {
/**
* A record of task IDs and their corresponding last queued task promises.
*/
private queue__: Dictionary<Promise<void>> = {};
private queue__: Dictionary<Promise<unknown>> = {};

/**
* Push a async task to the queue.
Expand All @@ -39,8 +39,8 @@ export class AsyncQueue {
* });
* ```
*/
async push(taskId: string, task: () => Promise<void>): Promise<void> {
const flatomise = newFlatomise();
async push<T>(taskId: string, task: () => Promise<T>): Promise<T> {
const flatomise = newFlatomise<T>();

const previousTaskPromise = this.queue__[taskId];
this.queue__[taskId] = flatomise.promise;
Expand Down

0 comments on commit aec6710

Please sign in to comment.