.frag
.frag
DTDrizzle Team
Created by .frag on 12/27/2024 in #help
ORM relation `where` does not exist in type
Can someone help me understand if I'm doing something wrong? The following code (adapted from Query/Select filters gives a 'does not exist' error on where:
export async function getItem(id: string, userId: string) {
const result = await db.query.item.findFirst({
where: eq(t.item.id, id),
with: {
collection: {
where: eq(t.collection.userId, userId)
}
}
});
return result;
}
export async function getItem(id: string, userId: string) {
const result = await db.query.item.findFirst({
where: eq(t.item.id, id),
with: {
collection: {
where: eq(t.collection.userId, userId)
}
}
});
return result;
}
Object literal may only specify known properties, and 'where' does not exist in type..
If schema matters, I have a user table, a collection table with fk (userId) and a item table with fk (collectionId). I should note that the query works, so maybe it's lacking proper types?
15 replies