K
Kysely13mo ago
mike

Zero number omitted from parameters

I looks like the compile() works incorrectly with zero number when used as parameter - the parameter is omitted from the array of sql components. Not included in sql params:
// used in case/when
.when(eb.fn.max('Orders.quantity'), '>', 0)

// used in case/then/else
.else(0)
// used in case/when
.when(eb.fn.max('Orders.quantity'), '>', 0)

// used in case/then/else
.else(0)
Included (workaround) in the params:
.when(eb.fn.max('Orders.quantity'), '>', sql<number>`0`)
.else(sql<number>`0`)
.when(eb.fn.max('Orders.quantity'), '>', sql<number>`0`)
.else(sql<number>`0`)
3 Replies
koskimas
koskimas13mo ago
Can you write a reproduction using https://kyse.link
mike
mikeOP13mo ago
Not successful with the error reproduction however can you please explain the error here? https://kyse.link/?p=s&i=PcVjEus2M3rnHBqEUGa6
koskimas
koskimas13mo ago
That's some weird bug in max function's typings. I opened an issue. Can use this instead: https://kyse.link/?p=s&i=1TSmdjJBKsgqVDDUpUZK
Want results from more Discord servers?
Add your server