What compile-time guarantees does that SQL library give? I don't see any docs or explanations at that Github repo and my TS knowledge is limited to be able to infer everything from a small code example.
Maybe clicking on the playground link would help your understanding of the project. You can literally hover over the types defined like:
type EX = Query<"some query string", db>;
and see the that the type as defined by the TS language server (i.e. in your editor) is the result of "running" the query without actually running the code. It's a little insane and somewhat akin to "type providers" in languages like F#.
For example, add this below `EX1` (line 66) in the TS Playground:
let names = (persons: EX1) => persons.map(person => person.name);
Now change the column alias in `EX1` to something other than "name" and see what happens. You see that? There is now a compile-time error.
For example, add this below `EX1` (line 66) in the TS Playground:
Now change the column alias in `EX1` to something other than "name" and see what happens. You see that? There is now a compile-time error.