dp
dp
Explore posts from servers
DTDrizzle Team
Created by dp on 6/23/2024 in #help
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
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
}
type Account = typeof accountSchema.$inferSelect & {
profile: Profile
}
4 replies