Lurker News
Back to discussion

Comment by h0h0h0h0111

h0h0h0h01111 reply#
Another potential benefit - runtime metaprogramming. All types are erased when converted to JS, but I can imagine a lot of utility for runtime types in Typescript.
williamdclt2 replies#
Obligated mention of runtypes (https://github.com/pelotom/runtypes) that bridges the gap between type-land and runtime-land. It's not seamless at all but if you have a serious need for this sort of thing, it's great
faichai1 reply#
I think there is some experimental decorator syntax which will allow for extracting type info. Does runtypes interop with that? Or is planning to?
phpnode#
there's the reflect-metadata package but the type information it exposes is very limited, "object" instead of {a: "foo"} and so on.