Skip to content

Commit

Permalink
no await
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciabad committed Mar 6, 2024
1 parent 1dc938d commit 4151942
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/server/helpers/translations/on-execute.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
export function doSomethingAfterExecute<
P extends { execute: (...args: any[]) => Promise<any> },
F extends (result: Awaited<ReturnType<P['execute']>>) => any,
Args extends Parameters<P['execute']>,
>({ execute, ...preparedStatement }: P, doSomething: F) {
return {
...preparedStatement,
execute: async (...args: Args) =>
(await doSomething(await execute(...args))) as ReturnType<F>,
execute: async (...args: Parameters<P['execute']>) =>
doSomething(await execute(...args)) as ReturnType<F>,
}
}

0 comments on commit 4151942

Please sign in to comment.