Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generic type in runWithContext #391

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add generic type in runWithContext
  • Loading branch information
nikostoulas committed Nov 7, 2024
commit e85fc99c845447978e652b5085f71e59e8059484
2 changes: 1 addition & 1 deletion src/builder.ts
Original file line number Diff line number Diff line change
@@ -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');
}
Loading