Skip to content

Commit

Permalink
fix: plugin AsyncHook types
Browse files Browse the repository at this point in the history
  • Loading branch information
caohuilin committed Jan 23, 2025
1 parent e9d70c1 commit 2ee6ba6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/toolkit/plugin-v2/src/types/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ export type SyncHook<Callback extends (...args: any[]) => any> = {

export type AsyncHook<Callback extends (...args: any[]) => any> = {
tap: (cb: Callback) => void;
call: (...args: Parameters<Callback>) => Promise<ReturnType<Callback>>;
call: (
...args: Parameters<Callback>
) => Promise<ReturnType<UnwrapPromise<Callback>>>;
};

export type AsyncInterruptHook<Callback extends (...args: any[]) => any> = {
tap: (cb: Callback) => void;
call: (...args: Tail<Parameters<Callback>>) => Promise<ReturnType<Callback>>;
call: (
...args: Tail<Parameters<Callback>>
) => Promise<ReturnType<UnwrapPromise<Callback>>>;
};

export type CollectAsyncHook<Callback extends (...params: any[]) => any> = {
Expand Down

0 comments on commit 2ee6ba6

Please sign in to comment.