Extract type from drizzle join for use elsewhere or exporting

I get the type in the same function scope like so
let query = db
.select()
.from(schema.event)
.where(and(...filters))
.leftJoin(schema.recurring_pattern, eq(schema.event.id, schema.recurring_pattern.event_id))

const eventRecurringPatterns = await query.execute()
let query = db
.select()
.from(schema.event)
.where(and(...filters))
.leftJoin(schema.recurring_pattern, eq(schema.event.id, schema.recurring_pattern.event_id))

const eventRecurringPatterns = await query.execute()
eventRecurringPatterns is typed with {event ,recurring_pattern} but how do I extract this type for use in other function params? Maybe with Parameters<typeof theJoin> I want to avoid doing it manually I imagine it starts something like this screenshot
2 Replies
Braveheart
BraveheartOP12mo ago
here is what I want to type automatically for use in this method param
Angelelz
Angelelz12mo ago
Why doesn't it work? What's the error?
Want results from more Discord servers?
Add your server