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)
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)
No description
3 Replies
Prisma AI Help
Prisma AI Help•6d ago
You chose to debug with a human. They'll tinker with your query soon. If you get curious meanwhile, hop into #ask-ai for a quick spin!
Josef Henryson
Josef HenrysonOP•6d ago
Update. I found out that there is a prismaWhereUnique method that seems to solve my problem above.
Nurul
Nurul•5d ago
Glad to hear that you were able to find the solution 🙌

Did you find this page helpful?