Skip to content

Comment on Pattern Matching Custom Data Types in TypeScript

Comments

I think the code is way too verbose. One supposed advantage of FP languages is that they are more concise. If I have to build a ton of boilerplate I might just as well go to some OOP pattern with interfaces and so on.

Remember that the point of the article is not what language does it best, but rather how to use typescript to add patterns from other languages.

True. I just think it's a mistake to force a pattern into a language that doesn't support it well. In the end you get sort of pattern matching but you have also to write a lot of code.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.