What does HackerNews think of ts-pattern?
🎨 The exhaustive Pattern Matching library for TypeScript, with smart type inference.
Language:
TypeScript
#85
in
JavaScript
#43
in
TypeScript
With how powerful the type system is you can implement pattern matching via a library pretty convincingly, https://github.com/gvergnaud/ts-pattern is definitely the go-to. That being said pattern matching is hardly a requirement for being ok for implementing compilers.
I'm quite fond of this library for pattern matching; it's a staple in all my new projects.
I'm not aware of any related to testing, but perhaps you could use something like this in tandem with some tests to pull it off?
> TypeScript doesn't even come with ADTs
You still can use them [0].
> proper pattern matching
[1] is pretty good.
[0] https://itnext.io/practical-introduction-to-algebraic-dataty...