jrydberg
jrydberg
Explore posts from servers
DTDrizzle Team
Created by jrydberg on 8/3/2024 in #help
How to get the type of transaction from a database?
best i've come up with is:
export const db = drizzle(sqlite, { schema: { ...schema } });
export type Database = typeof db;

type ArgumentTypes<F extends Function> = F extends (...args: infer A) => any
? A
: never;
export type Transaction = ArgumentTypes<
ArgumentTypes<Database['transaction']>[0]
>[0];
export const db = drizzle(sqlite, { schema: { ...schema } });
export type Database = typeof db;

type ArgumentTypes<F extends Function> = F extends (...args: infer A) => any
? A
: never;
export type Transaction = ArgumentTypes<
ArgumentTypes<Database['transaction']>[0]
>[0];
6 replies
DTDrizzle Team
Created by jrydberg on 8/3/2024 in #help
How to get the type of transaction from a database?
but how can i get the transaction type, enriched with the schema types?
6 replies