We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
const doWork = (..., tx: Transaction = db) {}
By doing this a given function can either be a standalone database operation or can be part of a higher up defined transaction
Here is one way to define the types
export type DB = typeof db; export type TX = Parameters<Parameters<DB['transaction']>[0]>[0]; export type DbOrTx = DB | TX;
and here is another
export type Transaction = | typeof db | Parameters<Parameters<typeof db.transaction>[0]>[0];
The text was updated successfully, but these errors were encountered:
No branches or pull requests
By doing this a given function can either be a standalone database operation or can be part of a higher up defined transaction
Here is one way to define the types
and here is another
The text was updated successfully, but these errors were encountered: