Parker Lawrence
06/03/2021, 4:33 PMincludes
? For example, suppose I have a query like this:
prisma.user.findUnique({
where: { id },
include: {
post: true
},
});
and I want to create a type for the result leveraging the Prisma generated types. something along the lines of this (I’ve just made up the Includes
helper tho):
import { User, Post } from '.prisma/client';
type UserWithPosts = Include<User, Post>;
Parker Lawrence
06/03/2021, 4:34 PMRyan
06/04/2021, 5:02 AMimport { Prisma } from '@prisma/client'
type T = Prisma.UserGetPayload<{
include: { posts: true }
}>
Parker Lawrence
06/04/2021, 1:49 PM