Pattern Matching for TypeScript
Paattern matching allows programmers to compare data with defined structures to easily pick one of the available expressions. Many languages that are designed as ‘functional programming languages’ have built-in keywords for pattern matching. Well know examples are F# (match … with) or Haskell (case … of). One language that works very well with functional programming but lacks those features is TypeScript. This library adds support pattern matching to TypeScript.
Read the article about this library for more context.
The features of this library include:
- Value patterns
- Record patterns
- Wildcard patterns
- Good type inference based on the patterns
- Negated patterns (including negated type inference)
- Additional predicates (like
matchblogOverviewResponse.with, r.map.with, new Errorr.errorMessage.otherwisenew Error'client parse error'.run
This library is written by Wim Jongeneel