Prisma-binding produces incorrect types for nullable update mutations



For a type with a nullable field, I should be able to send a mutation to update any of the nullable fields to null.


    where: { slug: "myCompany" },
    data: { vatNumber: null }
}, info);

However this yields a typescript error “Type ‘null’ is not assignable to type ‘string | undefined’.” This is because Prisma-binding produces incorrect types for the update input:

export interface CompanyUpdateInput {
  slug?: String
  name?: String
  vatNumber?: String
  businessId?: String

The nullable fields (vatNumber & businessId) should have the union type String | null, so I can null them if I wish.

Is this a bug in Prisma-binding or am I doing something completely wrong? I have updated to version 2. Prisma 1.9



Hey Frank, thanks for bringing this up.

Indeed, this seems unintended. However, I think it should be type string | null | undefined - undefined in the case it is not part of the input, and null if it’s explicitely set to null :slight_smile:

Can you create a bug report and/or PR here :raised_hands:

– Nilan


Sure thing! I’ll create a report