Type safety on .set() method?
Hey folks - I was wondering if there is a way to get type safety when updating a row using the .set method? In the example below,
updated_at is the table name, not the property name updatedAt. This code runs with no errors, but of course never updates the updated at because it doesn't exist!
Any tips for getting this to be type-safe ?5 Replies
Hey 👋
Can you share your tsconfig?

oh hmm
Anything you see?
Pretty new to the TS world
Thanks @Raphaël M (@rphlmr) ⚡
is your schema inside
src?
your include "doesn’t look common" (but there is so many possibilities haha)
"**/*.ts","**/*.tsx", "global.d.ts" should be enough to tell TypeScript that it has to check all of your filesAh was able to get it working...i think. The culprit was how i was initializing the db client. There is some weird hacky stuff around the SSL certificate when connecting to my prod db
Thank u!
Btw, would you know if there a nice way to do optional singles here? Often I'm retrieving one row and can be annoying to have to do
data?.[0] @Raphaël M (@rphlmr) ⚡update always returns an array this should be enough