Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm broadly a fan of just writing SQL, but Knex does have one important advantage: it automatically declares the return types from a query based on my DB structure. If I write SQL by hand, I have to annotate the query with the return types, and those annotations can get out of sync with the query.


Postgres.js does the same, transparently. No advantages of Knex here.


Slonik has a typegen package that works great, https://www.npmjs.com/package/@slonik/typegen




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: