Eric Simon
09/26/2022, 11:36 PM// Inferred type:
// User & {
// posts: Post[];
// }
const user = await prisma.user.create({
data: {
email: '<mailto:alice@prisma.io|alice@prisma.io>',
password: '0ee4808f893b8e05bdd251048d5c4c8af8bb89403676dda95619841a481f8e87',
name: 'Alice',
posts: {
create: {
title: 'Learn how to use Prisma with TypeScript',
content: '<https://www.prisma.io/docs/>',
},
},
},
include: {
posts: true,
},
})
Nurul
09/27/2022, 6:47 AMSamuele Guerrini
09/27/2022, 12:58 PMUser & { posts?: Post[], billingInfo?: BillingInfo, ... }
A type with all the relations without knowing in advance what relations were loaded by the caller.
The function should perform some generic work on the user entity and other work on the relations only if they were included by the caller.
Hope I made myself clear!
Thank you!Nurul
09/28/2022, 12:20 PMSamuele Guerrini
09/28/2022, 12:43 PMNurul
09/30/2022, 12:16 PMSamuele Guerrini
09/30/2022, 2:43 PM