Infer select that includes a foreign key object collection?

If I have a query such as the following:
const result = await db.query.users.findMany({
with: {
posts: true
},
});
const result = await db.query.users.findMany({
with: {
posts: true
},
});
how can I use something like
type SelectUser = InferSelectModel<typeof users>;
type SelectUser = InferSelectModel<typeof users>;
to infer users with posts included?
1 Reply
Angelelz
Angelelz13mo ago
type SelectUser = InferSelectModel<typeof users> & { posts: SelectPost[] }
type SelectUser = InferSelectModel<typeof users> & { posts: SelectPost[] }
Want results from more Discord servers?
Add your server