What does HackerNews think of zapatos?

Zero-abstraction Postgres for TypeScript: a non-ORM database library

Language: TypeScript

#30 in PostgreSQL
#50 in PostgreSQL
#54 in TypeScript
Check out zapatos[0]. Codegen tool that generates interfaces and type-safe queries from a running schema (db).

I've tried them all and this one allows me the most flexibility without abstracting much.

[0] https://github.com/jawj/zapatos

I’m surprised to see no mention of tagged literals, a much more complex version of template literals. For users they may seem ~like a function call without parentheses. But they do quite a bit more.

Short version: they accept an array of raw substrings and a variadic set of arguments corresponding to the runtime values provided in template positions, each positional value corresponding following the raw string preceding it.

That raw array is more than what it seems, it also has a getter of raw string values for the template expressions. This is what String.raw (also not mentioned) uses to treat those arguments essentially the same way an untagged template literal would.

It’s an odd design/interface but it can be used to do some pretty cool stuff. For example, Zapatos[1], a type-safe SQL library for TypeScript.

My only complaints:

- I can’t think of a real reason for it to be variadic, and this makes authoring them a little more error prone. You should be able to expect one array of strings with a length N, and one array of (type checkable/inferrable) values with a length N-1.

2. Likewise I can’t think of a real reason for the raw values to be bolted onto a weird array subclass. It could just as easily have been an iterable third argument.

1: https://github.com/jawj/zapatos