where filter returning typescript error when nested within a with

const disputedMatches = await db.query.active_members.findMany({
where: (active_members, { eq }) => eq(active_members.user_id, id),
with: {
match: {
where: (matches, { eq }) => eq(matches.status, 'DISPUTED'),
with: {
creatorTeam: true,
acceptorTeam: true,
game: true
}
}
}
});
const disputedMatches = await db.query.active_members.findMany({
where: (active_members, { eq }) => eq(active_members.user_id, id),
with: {
match: {
where: (matches, { eq }) => eq(matches.status, 'DISPUTED'),
with: {
creatorTeam: true,
acceptorTeam: true,
game: true
}
}
}
});
the where inside the with is giving a type error of
Object literal may only specify known properties, and 'where' does not exist in type '{ columns?: { id?: boolean; teamA_reported_status?: boolean; teamB_reported_status?: boolean; start_time?: boolean; expire_time?: boolean; team_size?: boolean; team_type?: boolean; admin_requested?: boolean; ... 14 more ...; teamB_id?: boolean; }; with?: { ...; }; extras?: Record<...> | ((fields: { ...; }, operators...'.ts(2353)
Object literal may only specify known properties, and 'where' does not exist in type '{ columns?: { id?: boolean; teamA_reported_status?: boolean; teamB_reported_status?: boolean; start_time?: boolean; expire_time?: boolean; team_size?: boolean; team_type?: boolean; admin_requested?: boolean; ... 14 more ...; teamB_id?: boolean; }; with?: { ...; }; extras?: Record<...> | ((fields: { ...; }, operators...'.ts(2353)
any guidance would be amazing
No description
4 Replies
Angelelz
Angelelz14mo ago
Filtering by nested relations was removed in v0.28: https://github.com/drizzle-team/drizzle-orm/releases/tag/0.28.0
GitHub
Release 0.28.0 · drizzle-team/drizzle-orm
Breaking changes Removed support for filtering by nested relations Current example won't work in 0.28.0: const usersWithPosts = await db.query.users.findMany({ where: (table, { sql }) => (...
Screw
ScrewOP14mo ago
hmmmm thank you! weird it still technically works tho
Screw
ScrewOP14mo ago
https://orm.drizzle.team/docs/rqb#select-filters and in the docs it shows i can still do this
WakaTime
WakaTime12mo ago
also wondering why the docs stills show this possible. the docs are out of date? oh nvm, the docs aren't clear https://discord.com/channels/1043890932593987624/1113148605142945822/1151552569408229496 it's actually filtering comments then joining, not filtering on the joined table
Want results from more Discord servers?
Add your server