So the prisma typescript definition for atomic operations says:
export type IntFieldUpdateOperationsInput = {
set?: number
increment?: number
decrement?: number
multiply?: number
divide?: number
}
The Prisma Schema:
model SomeEntity {
id Int @id @default(autoincrement())
quantity Int
}
So we have a variable that could be a number or undefined
const someQuantity:number|undefined = undefined
And we wanted to update the quantity field with this variable like so:
const client = new PrismaClient();
client.someEntity.update({ where: { id: 1 }, data:{ quantity:{ increment: someQuantity }}})
If someQuantity===undefined prisma throws an Error:
[ERROR] 09:47:48 Error: Invalid `prisma.someEntity.update()` invocation:
for the undefined value, but the type signature tells me that this should be valid.
we are using the prisma version 2.28.0 and a postgres db. Is there some configuration that I'm missing or is it just a bug that has to be reported.