Menu

Post image 1
Post image 2
Post image 3
1 / 3
0

Tagged Template Literals That Type-Check SQL: A 60-Line DSL

DEV Community·Gabriel Anhaia·28 days ago
#Z76m3OHh
Reading 0:00
15s threshold

Book: The TypeScript Type System — From Generics to DSL-Level Types Also by me: The TypeScript Library — the 5-book collection My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools Me: xgabriel.com | GitHub The query was wrong for two weeks before anyone noticed. A column got renamed from created to created_at in a migration, the report kept running, the report kept returning rows, the rows had null where created used to be. Nobody caught it because string is a type that does not know what a column name is. Drizzle and Kysely solve this. They are the right answer for a real codebase. But there is a small DSL you can build in about sixty lines that gets you most of the typing benefit when the surface is small enough that pulling in a query builder is the wrong shape: internal scripts, a one-table audit log, the migration tooling for your own product.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More