Deepkit – High-Performance TypeScript Framework
I'm not a fan of the idea of leveraging TS types at runtime. This is just a lock-in to TS, even if type annotations become a thing in JS.
I don't like ORMs that use runtime types either. Most of the time, I want to write raw SQL.<p>So as an experiment, I created a library that statically types raw SQL:<p><a href="https://github.com/nikeee/sequelts" rel="nofollow">https://github.com/nikeee/sequelts</a><p>The idea is to parse the SQL queries using TS's type system. The parsed query is combined with the database schema and therefore, we know what type the query will return.<p>This is especially useful due to TS's structural type system.
It's also zero-overhead due to the entire functionality being just TS types, which vanish as soon as we compile. It therefore also works JS-only.<p>However, it's just a proof of concept. I'm working on an ANTLR target for TS types, so that the SQL parser can be generated.
A game changer will also be the integration with sql-template-tags [1] (which would make this actually usable).<p>This is just for selecting data. Time will tell if it's feasible to also type-check mutating queries.<p>The primary use-cases will target SQLite/D1.<p>[1]: <a href="https://www.npmjs.com/package/sql-template-tag" rel="nofollow">https://www.npmjs.com/package/sql-template-tag</a>