© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
11 replies
francis

Is there a better way to extract Typescript types for use in function args than what I'm doing here?

export const client = drizzle(adminPgClient, { schema });
export type DrizzleClient = typeof client;
export type DrizzleTransaction = Parameters<Parameters<DrizzleClient["transaction"]>[0]>[0];
export const client = drizzle(adminPgClient, { schema });
export type DrizzleClient = typeof client;
export type DrizzleTransaction = Parameters<Parameters<DrizzleClient["transaction"]>[0]>[0];


It works well enough, but this seems like something which should be exposed on a library level, maybe? I need it in order to e.g. write a function which takes in a transaction and performs operations on it, such that multiple functions can be called on a single transaction and then the transaction either committed or rolled back as one unit (so the client cannot be passed in instead).
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Is there a better way to access enum types?
Drizzle TeamDTDrizzle Team / help
3y ago
Is there a way I can use relational types?
Drizzle TeamDTDrizzle Team / help
3y ago
is there a way to use Redis in drizzle
Drizzle TeamDTDrizzle Team / help
2y ago
Is there a way to define "nullable" types for magic SQL?
Drizzle TeamDTDrizzle Team / help
2y ago