Type for select with relations?

Is it possible to infer select with relations? Currently im using:
export let user: typeof user.$inferSelect & { profile?: typeof profile.$inferSelect };
export let user: typeof user.$inferSelect & { profile?: typeof profile.$inferSelect };
5 Replies
ericmartinezr
ericmartinezr12mo ago
I would also like to know how to achieve this. Thanks for the workaround btw.
Angelelz
Angelelz12mo ago
I think this is a good way. We were discussing a way to provide some kind of helper but it's we haven't arrived to a solution that's easy and helpful yet Another way of doing it is with the ReturnType Utility type
ericmartinezr
ericmartinezr12mo ago
How would you go with the ReturnType utility? I can't find anything about it in the docs
Angelelz
Angelelz12mo ago
It's not in the docs, it's just typescript stuff
Want results from more Discord servers?
Add your server