RetroFed Forums
Your home away from modern life.
TypeSQL: write plain SQL strings, get exact TypeScript types (no codegen)
Post Reply
AuthorMessage
ismail lemmy.ml ismail@lemmy.ml
Joined: 2023-04-26
(edited) Quote

I created this new library that parses Postgres SQL inside TypeScript’s type system. You write a SQL string and the compiler infers the row and parameter types. It needs no codegen and no database connection.

const q = sql(`SELECT u.id, u.email, p.title
               FROM users u LEFT JOIN posts p ON p.author_id = u.id
               WHERE u.id = ${sql.param(7)}`);
// { id: number; email: string; title: string | null }

sql("SELECT nme FROM users");
// error: column "nme" does not exist
  • Handles joins, CTEs, subqueries, window functions, INSERT/UPDATE/DELETE … RETURNING
  • Runs on pg or postgres.js, and can reuse your existing Kysely, Drizzle or Prisma schema
  • Requires TypeScript 7

https://github.com/ismailkarsli/typesql

Feedback welcome, especially queries that don’t type-check but should.

1   Original
RumRunningDevil lemmy.zip RumRunningDevil@lemmy.zip
Joined: 2026-03-18
#2 · Quote Reply

(Insert LLM) creates this new library...

Brother you want feedback for an entirely llm-coded project? The first commit is 25k LoC.

9
ExperimentalGuy programming.dev ExperimentalGuy@programming.dev
Joined: 2023-07-25
#3 · Quote Reply

Literally why. Just do what the diesel rust crate does with their macros.

2
Cellery quokk.au Cellery@quokk.au
Joined: 2026-09-30
#4 · Quote Reply

Literally why. Just do what the diesel rust crate does with their macros.

It’s just so they can get dependencies out in the wild and then they add malicious code. This is why we should all learn to code… simply so we can stop being lazy and write our own is_even functions.

5
ismail lemmy.ml ismail@lemmy.ml
Joined: 2023-04-26
#5 · Quote Reply

(Insert LLM) creates this new library... Brother you want feedback for an entirely llm-coded project? The first commit is 25k LoC.

It passes full PostgreSQL test suite. I'm trying to put it on a solid foundation.

To be honest, I didn't have much faith in vibe-coded projects either, but my belief has grown stronger as I've seen more potential projects.

Also, don't assume I'm completely unfamiliar with the code. I've done the planning, chosen the project structure, and reviewed a significant portion (though perhaps superficially) of what I considered important.

-3
ismail lemmy.ml ismail@lemmy.ml
Joined: 2023-04-26
#6 · Quote Reply

Literally why. Just do what the diesel rust crate does with their macros.

This is TypeScript, diesel is Rust.

0
RumRunningDevil lemmy.zip RumRunningDevil@lemmy.zip
Joined: 2026-03-18
#7 · Quote Reply

It passes full PostgreSQL test suite. I'm trying to put it on a solid foundation. To be honest, I didn't have much faith in vibe-coded projects either, but my belief has grown stronger as I've seen more potential projects. Also, don't assume I'm completely unfamiliar with the code. I've done the planning, chosen the project structure, and reviewed a significant portion (though perhaps superfici...

See, this is the problem with vibe-coded projects and LLMs in general. They are fundamentally atomizing.

I can only speak for myself, though anecdotally I would guess this is not an uncommon position, when I say that this isn't fun. To build a community around a project you need people to be excited about the project and to be willing put free time into it because of that.

Vibecoding an app removes all the parts that made building a project fun and leaves behind only the shitty ones; the ones you specifically highlighted, the project management ones.

Maybe you got into software because you really love Agile and Gantt charts but, for a lot of people, the appeal was the craft. Open source was awesome because they can build things with like-minded people in a way that is tactile and interactive. Not unlike woodworking or metalworking hobbyists. LLMs take that part and light it on fire.

Sure, the bot can churn out fully functioning code for me. But I'm not excited about it, and I'm certainly not excited about someone else's.

3
Post Reply
Back to top