Reusable values for `with` property in findFirst and findMany

This works as expected: const result = await db.query.users.findFirst({ with: { usersMeta: true }}); I want to achieve something like this:
const defaultWith = { usersMeta: true };
const result = await db.query.users.findFirst({ with: defaultWith });
const defaultWith = { usersMeta: true };
const result = await db.query.users.findFirst({ with: defaultWith });
Typescript complains about the type at with: defaultWith. Is it possible to make the with-property value reusable across multiple query code snippets?
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?