How can I get the Typescript return type of a drizzle statement?

// How can I type the return type of this function?
export function selectUserIncludingToken(userId: User["id"]): ?? {
  return db
    .select()
    .from(eghlTokens)
    .rightJoin(users, eq(eghlTokens.userId, users.email))
    .where(eq(users.id, userId))
    .orderBy(desc(eghlTokens.createdAt))
    .limit(1);
}
Was this page helpful?