What is the type of transaction prop?
When creating a transaction I get this prop
I am trying to define a function like this
This way I can reuse the same functions with and without a transaction, I am having trouble typing the
Transaction
type, the type in vscode is a long complex type and I was wondering if there is some exported type I could use4 Replies
right now I am typing it like this
but I want to get rid of at least the imports, it's gonna mess up when building on cloud
export DbType= typeof<db>
this should work. simple typescript
For postgres it is
If anyone else runs across this here's what worked for me. This is an easy way to get the actual transaction type. (Using typeof db may work but it isn't the same.)
tx: Parameters<Parameters<typeof db.transaction>[0]>[0]