Prisma is not returning a type that has the property for the included relation
Hello,
I am using prisma to query some data from my database where the name of the relatonship is
data
so the final record object looks something like this
The record returned from Prisma has the data
but is typed to look like
Any idea why this might be? Is there something I have to do to extend the type with the related model?5 Replies
Show us your prisma schema please
and then the prisma query looks like
Have you migrated ur database and generated a new prisma client after adding the memberData relation?
Yes, did some further research and found that Prisma actually does not generate types for the relationship, so I winded up using
type MemberWithData = Prisma.MemberGetPayload<{ include: { data: true } }>;
and then cast the results as this type. Not my favorite solution but it is working.
https://github.com/prisma/prisma/discussions/10928GitHub
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...
Really weird. I query related rows all across my app and never had that problem
Are you using a noSQL database?