Hacker GitHub

← All repos

adelsz/pgtyped

View on GitHub ↗ ★ 3,286 TypeScript

pgTyped - Typesafe SQL in TypeScript

25 mentions on Hacker News by 18 people: 2 stories, 23 comments · first 2019-09-29 · latest 2025-10-05

Mentions per year 25 mentions · busiest year 2021 (7)
20082026
  1. https://github.com/adelsz/pgtyped
  2. …in the past and it does a good job at taking raw SQL and generating the return types from runtime: https://github.com/adelsz/pgtyped
  3. …more practical takes that codegen types from your database and generate types for your queries, eg: https://github.com/adelsz/pgtyped To me the second approach seems much more pragmatic because you don’t need to run a SQL parser in your…
    comment by jitl · 2024-03-24 · in Type-Safe Printf() in TypeScript
  4. …liking pgTyped. Transactions are supported as pgTyped is just a thin wrapper around node-postgres: https://github.com/adelsz/pgtyped/discussions/448
  5. I wonder why pgtyped [1] was skipped [1] https://github.com/adelsz/pgtyped
  6. How does this compare with pgTyped[1]? [1] https://github.com/adelsz/pgtyped
  7. There's pgtyped, which I believe does almost the same as sqlc https://github.com/adelsz/pgtyped
    comment by lacasito25 · 2023-04-29 · in Deno 1.33: Deno 2 is coming
  8. For Postgres there is https://github.com/adelsz/pgtyped , sounds pretty much like what you describe?
    comment by csnweb · 2023-01-24 · in Kysely: TypeScript SQL Query Builder
  9. You might also want to consider pgTyped ( https://github.com/adelsz/pgtyped ). It's supposed to make SQL and TS work together. I haven't gotten around to using it yet but I hear good things.
    comment by robertn702 · 2023-01-24 · in Kysely: TypeScript SQL Query Builder
  10. …with TypeScript(/WASM-target for the future?), with a type-safe SQL codegen library such as: https://github.com/adelsz/pgtyped Update update: Or reluctantly with Python instead, with a similar library such as PugSQL.
  11. PgTyped is another high quality alternative: https://github.com/adelsz/pgtyped .
  12. We're using a very similar lib for typescript: https://github.com/adelsz/pgtyped Would love to hear if any others of comparable or better quality exist for js/ts
  13. …more of the fact that we don't know how to do it properly than it not offering a good solution. [1] https://github.com/adelsz/pgtyped [2] https://github.com/ovotech/laminar
  14. If I'm understanding you, you might like pgtyped: https://github.com/adelsz/pgtyped (If you mean infer solely off of queries, I don't think that's possible unless you jam a bunch of type casts into the field selection part of the query.)
  15. …as soon as you need to do anything complicated with lots of joins or advanced SQL features. 1. https://github.com/adelsz/pgtyped 2. https://jawj.github.io/zapatos/
    comment by smt88 · 2021-06-18 · in DenoDB
  16. …and it is great for writing arbitrary SQL queries and getting full typescript support. [1] https://github.com/adelsz/pgtyped
    comment by nickreese · 2021-04-21 · in Prisma – ORM for Node.js and TypeScript
  17. …data access for your project, but for just replacing ORMs I think I really prefer the approach of https://github.com/adelsz/pgtyped where you have raw sql files / template literals and it will create types for parameters and results.
  18. …no knowledge of the pg schema, so it cannot help with this. You may want to look at something like https://github.com/adelsz/pgtyped . The downside is that dynamic queries are more challenging. We have been looking at moving over to…
  19. …Now TS and sql doesn’t really have a robust lib for that I think, last time I checked it was only https://github.com/adelsz/pgtyped But haven’t looked at how far it has progressed.
  20. I've been following https://github.com/adelsz/pgtyped for awhile. It should give you TS types from sql files (and even sql template literals) directly. Though I haven't used it in prod. Might be worth a look.
  21. ▲ 269
    Show HN: PgTyped – Typesafe SQL in TypeScript and Postgres
    story by alde · 2020-05-25 · 88 comments
  22. …implement SQL-in-TS type inference in PgTyped[1] with autocomplete and validation on the way. [1]: https://github.com/adelsz/pgtyped
  23. …Still very alpha, but promising. I'm working on integrating PgTyped into Huncwot [2] [1]: https://github.com/adelsz/pgtyped [2]: https://github.com/huncwotjs/huncwot
  24. …generator that makes it possible to use inline SQL in TypeScript code with guaranteed type-safety. https://github.com/adelsz/pgtyped
  25. ▲ 9
    Show HN: PgTyped – Typesafe SQL – TypeScript types generator for raw SQL queries
    story by alde · 2019-09-29 · 3 comments