prisma relations generated types
So I've ran to a problem where the generated types from prisma don't include my relationships, I've googled a bit more and saw this was an issue for many people but not many people have any answers at all, wondered if anyone here know how to deal with this?
I've tried creating my own type with the prims getPayload and including my relationships but when fetching data it is automatically refering to the generated prisma types and I cant go around hardcoding that everywhere it seems like a bad idea...
Trying to deploy and it keeps failing because of that 😦
10 Replies
GitHub
Generated prisma types are missing relationships in their exported ...
Bug description So I am really not sure if this is a bug, my mistake or some really stupid feature. I started using prisma in force a few days ago and so far, I love it, but I am struggling to unde...
i think it has been already answered
if you mean this problem
Same thing on the prisma docs with more examples https://www.prisma.io/docs/concepts/components/prisma-client/advanced-type-safety/operating-against-partial-structures-of-model-types
Prisma
Operating against partial structures of your model types
This page documents various scenarios for using the generated types from the Prisma namespace
Yes I've read that and used that but on someplaces in my code, the return type of my data is more complex and it's using the generated types by prisma anyways
so it doesn't solve that
It still searches for types from prisma
anyone? 😐
How about using type inference based on the function you’re using which fetches the row + relationships?
What do you mean?
Something like this
I had to fix my function return value, it was a problem there, which is weird because the type is the same