Type error with tRPC, Zod, Prisma

Hey guys, I'm new to Typescript and the t3-stack and I cannot seem to figure out how to solve this error. How do I delcare the correct type for this "userId" input? The error reads: (property) userId?: string | Prisma.StringNullableFilter | null | undefined Type '{ id: string; }' is not assignable to type 'string | StringNullableFilter | null | undefined'.ts(2322)
4 Replies
Matvey
Matvey2y ago
use input.id instead of input
where: {
userId: input.id
}
where: {
userId: input.id
}
needmorewood
needmorewood2y ago
the error is showing you that you are trying to set the userId as '{id: 'something'}' when its looking for a string instead og the object you provided
cje
cje2y ago
learning to read type errors is important it's saying "you're giving me the thing on the left, i need the thing on the right"
theFern
theFernOP2y ago
Amazing.. thanks so much guys!
Want results from more Discord servers?
Add your server