Skip to content

Commit

Permalink
Add generic type in runWithContext
Browse files Browse the repository at this point in the history
  • Loading branch information
nikostoulas committed Nov 7, 2024
1 parent 4b964c7 commit e85fc99
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let als: AsyncLocalStorage<Map<string, any>> = new AsyncLocalStorage<Map<string,

export const getRequestContext = () => als?.getStore();

export const runWithContext = (store: Map<string, any>, callback: (args: any[]) => void, ...args: any[]) => {
export const runWithContext = <T>(store: Map<string, any>, callback: (args: any[]) => T, ...args: any[]) => {
if (!als) {
throw new Error('AsyncLocalStorage is not supported');
}
Expand Down

0 comments on commit e85fc99

Please sign in to comment.