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
use
input.id
instead of input
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
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"
Amazing.. thanks so much guys!