can you Infer relations?

im really loving how drizzle plays well with relations, but im wondering is there a way to get types for relations? in prisma you can use Prisma.YourModelGetPayload<{}> to generate a type with relations, is this possible with infermodel? i tired the most obvious way and that didnt work
InferModel<typeof userRelations>;
InferModel<typeof userRelations>;
3 Replies
Dan
Dan2y ago
Not possible at the moment, but it's a good thing to have, will add it to backlog
ejoo
ejoo16mo ago
I do it likes this
type Post = InferModel<typeof schema.posts> & {author: InferModel<typeof schema.users>} & {likes: InferModel<typeof schema.likes>[]};
type Post = InferModel<typeof schema.posts> & {author: InferModel<typeof schema.users>} & {likes: InferModel<typeof schema.likes>[]};
Want results from more Discord servers?
Add your server