Lurker News

Comments (191) 32 threads

Earlier comments
UhDev1 reply#
I think that TypeScript is nice but I would never touch a database running on javascript.
svieira#
Oh, this isn't running on JavaScript - this is running on TypeScript's _typer_!

... which is implemented in JavaScript ... er ... don't know if that changes your desires to use this in PRODUCTION.

meijer#
This feels a bit like C#'s "Linq to Objects". Could actually be useful!
ralusek2 replies#
I'm viewing this on my phone, so maybe I'm missing something, but isn't this getting all of its typing information from you explicitly declaring a result set `as const`, and then subsequently doing `typeof` that const value? How does that help in real world queries, where the result sets are dynamic? Also, how does it help beyond just naturally declaring a result set as const without the use of this library?
phpnode2 replies#
oh let's be clear there's no sensible real world use cases of this thing. it's a demonstration of what TS's type system can do
chrismorgan#
Art is all about making interesting things that serve no functional purpose, though often they have useful byproducts.

This is a work of art.

nikki93#
One use case of something similar is generating a regular expression matcher at compile time for example. This is what the C++ library https://github.com/hanickadot/compile-time-regular-expressio... does.

There are a lot of uses of compile-time code. One I have been interested in is generating bindings to other languages or generating serialization code, or even generating bytecodes for VMs with specific bytecodes for accessing your native data structures (instead of adding a level of indirection).

tobyhinloopen1 reply#
This project allows you to query (transform) type definitions as data to create new type definitions using SQL.

Dynamically transforming types could be useful to generate complex types based on other complex types.
This project takes it to the extreme by adding an SQL interface to it

ralusek#
Ya I took a look again. It is very strange, but impressive.

All comments shown.