© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•2y ago•
3 replies
dp

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
Account
type like this:

type Account = typeof accountSchema.$inferSelect
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
profile
relation similar to the
profile_info
profile_info
example in the docs.

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

type Account = typeof accountSchema.$inferSelect & {
  profile: Profile
}
type Account = typeof accountSchema.$inferSelect & {
  profile: Profile
}
Drizzle ORM - Query
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

.$inferSelect for relations
Drizzle TeamDTDrizzle Team / help
3y ago
View No $inferSelect
Drizzle TeamDTDrizzle Team / help
17mo ago
Type Hinting $inferSelect
Drizzle TeamDTDrizzle Team / help
2y ago
Omit fields on "$inferSelect"?
Drizzle TeamDTDrizzle Team / help
3y ago