Actually, I wrote a lot of code in TypeScript and I know my SQL but I have absolutely no idea what is going on here.
Actually, I wrote a lot of code in TypeScript and I know my SQL but I have absolutely no idea what is going on here.
https://devblogs.microsoft.com/typescript/announcing-typescr...
As this project demonstrates type systems are far more than just glorified comments. Indeed, they are in fact a rigorous scaffolding that seemingly magically "intuit" the intention of code without having to run it. This project playfully explores the extent of Typescript's particular powers.
So I'm guessing there's no real practical use case for this, and is a nice flex from the author.
It would be nice if that were made dead clear in the Readme, something like "Why? Because it's fun"
It's more of an experiment of thoughts to generate types that are defined by the result of the SQL query, bending a compiler to a new strange behaviour that happens to be SQL like.
If you think this is useless because it doesn't generate any code then I'm assuming you're not familiar with typescript because type level libraries isn't supposed to do do that anyway. There are already libraries that generate open api client and graphql client but they generate type definition via an extra build step which libraries like this can eliminate.
And this typescript feature was made to parse strings so no this is not "bending the compiler"