unsplash / sum-types

Safe, ergonomic, non-generic sum types in TypeScript.
https://unsplash.github.io/sum-types/
MIT License
42 stars 2 forks source link

Match multiple branches #41

Open samhh opened 2 years ago

samhh commented 2 years ago

A limitation of our object-based matching API is that an equivalent to the following isn't possible:

case x of
  A, B -> etc
  C    -> etc
switch (x) {
  case A:
  case B:
    return etc;
  case C:
    return etc;
}