Re:Show HN: PgTyped – Typesafe SQL in TypeScript and Postgres
by mceachen on Monday May 25, 2020 @03:19PM
(#23303987)
I wrote the original typescript bindings for objection. One of the library authors is a contributor to knex.js, which objection uses for query building. Both are quite nice.
With either library, you aren't writing naked SQL, but something like `query.where("updated_at", ">", Date.now())`. Tsc comes into play when you send typed objects into your .where, .insert, ... methods and what you get back from the query.
It's close enough to SQL that you don't lose expressiveness, you're not behind walls of magick due to orm, and you don't have to worry about Bobby Droptables.
Re:Show HN: PgTyped – Typesafe SQL in TypeScript and Postgres
by renke1 on Monday May 25, 2020 @02:28PM
(#23303486)
Thanks, I'll check it out. But on first glance it doesn't seem to let me write actual SQL queries. Also, it doesn't seem to be typesafe, or is it?
Re:Show HN: PgTyped – Typesafe SQL in TypeScript and Postgres
by chrischen on Monday May 25, 2020 @02:56PM
(#23303768)
It says it has typescript support.
[1] https://vincit.github.io/objection.js/