PrismaP
Prisma11mo ago
3 replies
Josef Henryson

How to define types in Pothos that work with Prisma?

Hi. I am trying to migrate from nexus to Pothos. But I run in to some trouble when trying to define my input types.
See image for example of my code.
The Prisma delete function does not agree on my defined type. Can you see what I am missing? TS error below:

Type 'PickFields<UserWhereInput, Partial<Record<keyof UserWhereInput, unknown>>>' is not assignable to type 'UserWhereUniqueInput'.
  Type 'PickFields<UserWhereInput, Partial<Record<keyof UserWhereInput, unknown>>>' is not assignable to type '{ id: string; email: string; pictureId: string; } & { id?: string | undefined; email?: string | undefined; pictureId?: string | undefined; AND?: UserWhereInput | UserWhereInput[] | undefined; ... 34 more ...; guestRecruitments?: RecruitmentListRelationFilter | undefined; }'.
    Type 'PickFields<UserWhereInput, Partial<Record<keyof UserWhereInput, unknown>>>' is not assignable to type '{ id: string; email: string; pictureId: string; }'.
      Types of property 'id' are incompatible.
        Type 'string | StringFilter<"User"> | undefined' is not assignable to type 'string'.
          Type 'undefined' is not assignable to type 'string'.ts(2322)
image.png
Was this page helpful?