PrismaP
Prisma11mo ago
8 replies
Florian

Composing relation types

How do ya'll set up your relation types?

I currently have one big type that includes all relations:

export type ProjectData = Prisma.ProjectGetPayload<{
  include: {
    tasks: true;
    attachments: { include: { user: true } };
    members: { include: { user: true } };
    _count: { select: { comments: true; attachments: true } };
  };
}>;


But some in places I only use a subset of these values.

I assume I should split that up. But what then? Do you create combinations of types like type ProjectWithTasksAndAttachments = ProjectWithTasks & ProjectWithAttachments?

What's your approach?
Was this page helpful?