omar-dulaimi / prisma-zod-generator

Prisma 2+ generator to emit Zod schemas from your Prisma schema
MIT License
535 stars 45 forks source link

Prisma 5.7.0 upsert opertions #92

Open danil-iglu opened 8 months ago

danil-iglu commented 8 months ago

Bug description

I have a following error during compilation when I trying to use types.

  The types of '_type.update' are incompatible between these types.
    Type '(userUpdateWithoutProfileInput | userUncheckedUpdateWithoutProfileInput) & (userUpdateWithoutProfileInput | userUncheckedUpdateWithoutProfileInput | undefined)' is not assignable to type '(Without<userUpdateWithoutProfileInput, userUncheckedUpdateWithoutProfileInput> & userUncheckedUpdateWithoutProfileInput) | (Without<...> & userUpdateWithoutProfileInput)'.
      Type 'userUpdateWithoutProfileInput & userUncheckedUpdateWithoutProfileInput' is not assignable to type '(Without<userUpdateWithoutProfileInput, userUncheckedUpdateWithoutProfileInput> & userUncheckedUpdateWithoutProfileInput) | (Without<...> & userUpdateWithoutProfileInput)'.
        Type 'userUpdateWithoutProfileInput & userUncheckedUpdateWithoutProfileInput' is not assignable to type 'Without<userUncheckedUpdateWithoutProfileInput, userUpdateWithoutProfileInput> & userUpdateWithoutProfileInput'.
          Type 'userUpdateWithoutProfileInput & userUncheckedUpdateWithoutProfileInput' is not assignable to type 'Without<userUncheckedUpdateWithoutProfileInput, userUpdateWithoutProfileInput>'.
            Types of property 'ipdId' are incompatible.
              Type 'string | NullableStringFieldUpdateOperationsInput | null | undefined' is not assignable to type 'undefined'.
                Type 'null' is not assignable to type 'undefined'.ts(2322)

The error happens with this:

  export type NullableStringFieldUpdateOperationsInput = {
    set?: string | null
  }

How to reproduce

Generate with mentioned prisma version and see upsert operation result.

UPD: another case is multiple unique keys in the model - the schema is generated incorrectly. It breaks the compilation.

Expected behavior

No response

Prisma information

Unable to provide

Environment & setup

Prisma Version

5.7.0