Why Prisma does not set the proper type for related field?
So I've been banging my head against this issue lately and it seems to me that the only way around is to create a separated ZodSchema to solve it.
Thing is that in my PostgreSQL database I have an optional relation but when I query with that relation the type that I get back is still optional, even though I pass that to the query in order to get the rows 🤔
Here's for example, in my
Transaction
table the hodlId
field is optional. But I am just passing it, so how it could be optional if that's the base of my query?
As you can see I had to create a separate type and cast it to the response.
Is that the only way to do it? Dunno, every time I need to use a cast I feel of a stretch 😅0 Replies