K
Kysely7mo ago
djMax

Multiple calls to values in insert statement?

I just had a production bug where I was calling .values multiple times on a query object. I've fixed it by passing an array to a single values call instead, but this seems like a bug no? Either the types should reflect that values can no longer be called after it has been, or it should collect the values calls into one array?
2 Replies
koskimas
koskimas7mo ago
It's not a bug.. it's just a case of not 1000% strict types. It's insane what people consider bugs in the typescript world. If something is theoretically possible to do using typescript, not doing it is not automatically a bug.
djMax
djMax7mo ago
typescript is intended to give some dev-time information about your conformance to expectations, and in this case it does not do that. And I would argue it's pretty easy to fix in that the values method should just return a type that omits the values method, no? or, at runtime, it should scream bloody murder rather than dropping data on the floor and acting like everything is just fine
Want results from more Discord servers?
Add your server