News for hackers. Stuff that matters.
Re:Show HN: PgTyped – Typesafe SQL in TypeScript and Postgres by timmy-turner on Monday May 25, 2020 @03:16PM (#23303962)
Writing literal SQL in JS would IMO need more tools than just a preprocessor like you describe.

The few times I tried it (mostly in tests to check that the ORM is working properly) the #1 thing I was missing is a prettier-plugin that automatically formats SQL in the same way it currently works for `html` tagged templates.

I completely agree to the 'constrained by ORM' and 'useless features' part though. Postgres `json_agg` is a godsend and I love to be able to reason over simple joins and queries.

BTW, my own approach to use `json_agg`, `json_build_object` and json columns within a typesafe query-building DSL is this: https://github.com/hoeck/typesafe-query-builder

But its mostly for replacing simple ORM fetches, it wont do complex analytical queries. For that I'd like to write SQL directly as query-DSLs tend to quickly stop being usable in that situation.

Re:Show HN: PgTyped – Typesafe SQL in TypeScript and Postgres by cyral on Monday May 25, 2020 @05:13PM (#23305044)
One of my favorite features of WebStorm is the (official) database plugin which highlights SQL queries inside JS strings AND has autocomplete and refactoring support that actually uses the live database schema.
Re:Show HN: PgTyped – Typesafe SQL in TypeScript and Postgres by mekster on Monday May 25, 2020 @09:08PM (#23306473)
But unfortunately returned values have no type definition unless manually provided.