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()

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
Was this page helpful?