What’s the type for a Transaction in Drizzle?

by Dan Edwards

Learn how to properly type Drizzle ORM transactions in TypeScript. This quick guide shows you how to extract transaction types or interfaces.

Drizzle doesn’t provide a type for transactions, so you need to extract it yourself.

types/definitions/database.ts
TypeScript
1import type { drizzle } from 'drizzle-orm/node-postgres'
2
3export type DrizzleClient = ReturnType<typeof drizzle>
4export type Transaction = Parameters<Parameters<DrizzleClient['transaction']>[0]>[0]

Published Saturday, 26 April 2025