K
Kysely12mo 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
koskimas12mo ago
Can you write a reproduction using https://kyse.link
mike
mike12mo ago
Not successful with the error reproduction however can you please explain the error here? https://kyse.link/?p=s&i=PcVjEus2M3rnHBqEUGa6
koskimas
koskimas12mo 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