Hacker News new | ask | show | jobs
by gunshowmo 1540 days ago
Recent updates in TypeScript have also made ADTs much better to use and make expressing business logic in a statically safe way. It's incredible how much mental overhead that good typing systems (and good utilization of them) can save you when navigating complex code bases.
2 comments

You still need to tag your own unions though, right?
Yes, and since typing is only at compile time, it's also missing some of the extremely convenient pattern matching syntax that I love from Haskell, Rust, Scala, etc....

Despite some downside, I'm a huge fan overall though. I haven't tried ReasonML or ReScript, but compared to bare JS, TypeScript makes frontend programming a lot more enjoyable to me.

I consider ReasonML and ReScript to be effectively dead since they split the community a few times now. I don't know anyone who's actually using either in production, except for their respective sponsors Meta and Bloomberg.
Why is pattern matching not possible when types are removed after typescript is compiled?
That was my first interpretation as well, and I don't think there's actually any such technological limitation.

But I think what was meant is that typescript's mostly committed to not changing runtime behavior of the JS that remains when you strip the types away, and while I we might disagree with that goal or with its application in this instance, I can at least see the flow of the reasoning and label it a matter of priorities.

What are the recent changes?