tRPC findUnique problem

I am having this issue with tRPC which driving me crazy
No description
5 Replies
TOSL
TOSL4w ago
Looks like a type error more related to Prisma than trpc. I guessing because findUniqueOrThrow isn't nullable. But you defined your output as product.nullable(). Let me know if that's the issue.
şiar_619
şiar_619OP4w ago
i am not with my laptop rn but i tried that as well it doesn’t work even cursor cant fix it btw
TOSL
TOSL4w ago
Can you try explicitly typing the product variable?
const product: productSchema | [whatever prisma error that could occur] = your query
const product: productSchema | [whatever prisma error that could occur] = your query
şiar_619
şiar_619OP4w ago
i didnt understand what you said but i tried this and it works
No description
şiar_619
şiar_619OP4w ago
i closed and reopened cursor and it worked lol thank you for your help

Did you find this page helpful?