creating external types based on drizzle types

hey I'm trying to abstract some of my drizzle calls into seperate functions to refactor my code. How would I go about getting the type that my .values() enforces on the current table and replacing my data: any with that?
export async function createInvite(data: any) {
const invite = await db
.insert(data)
.values({
...data
})
.returning({ inviteId: data.id });

return invite;
}
export async function createInvite(data: any) {
const invite = await db
.insert(data)
.values({
...data
})
.returning({ inviteId: data.id });

return invite;
}
2 Replies
Revan
Revan14mo ago
InferInsertModel<typeof table>
DrX
DrXOP14mo ago
Thank you Revan! ❤️
Want results from more Discord servers?
Add your server