I have a model with a relation to a separate model. I’m now querying the object and the related object. But how do I get a typescript type so that I can pass this object to subcomponents of my react component?
This only give me the Event type without the nested Owner
property/relation.
import { Event, Prisma } from "@prisma/client";
type EventDetailsProps = {
event: Event;
};
And this is not working too:
type EventDetailsProps = {
event: Prisma.EventInclude;
};
2
Answers
I solved it this way:
More details here.
try
Prisma.EventFieldRefs
however you will have to overwrite relations fields as they are of String type. Otherwise read more