Way to get relations via typeof someSchema.$inferSelect?

Is there a way to get a type of a database schema with the relations included?

Currently, I get my
Account
type like this:

type Account = typeof accountSchema.$inferSelect


But that doesn't give me the relations I've built into the Account type (in my case I have a profile relation similar to the profile_info example in the docs.

Do I just need to build this manually? Something like this?

type Account = typeof accountSchema.$inferSelect & {
  profile: Profile
}
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Was this page helpful?