Hacker GitHub

← All repos

gvergnaud/ts-pattern

View on GitHub ↗ ★ 15,206 TypeScript

🎨 The exhaustive Pattern Matching library for TypeScript, with smart type inference.

15 mentions on Hacker News by 13 people: 5 stories, 10 comments · first 2021-05-14 · latest 2026-10-18

Mentions per year 15 mentions · busiest year 2023 (4)
20082026
  1. …language across the stack. With the said, you can do exhaustive pattern matching in TypeScript! https://github.com/gvergnaud/ts-pattern
    comment by shepherdjerred · 2026-10-18 · in Java sealed classes and exhaustive pattern matching
  2. …than a statement, so it can replace awkward terenaries. And it has no transitive dependencies! [1]: https://github.com/gvergnaud/ts-pattern
  3. You might like ts-pattern https://github.com/gvergnaud/ts-pattern
    comment by shepherdjerred · 2024-08-06 · in Please do not attempt to simplify this code
  4. …at the end of a match call and I believe you get the error at typechecking time, not runtime. https://github.com/gvergnaud/ts-pattern
  5. …matching, but obviously has downsides that could be avoided if it was built into the language. https://github.com/gvergnaud/ts-pattern
  6. …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…
  7. I'm quite fond of this library for pattern matching; it's a staple in all my new projects. https://github.com/gvergnaud/ts-pattern
  8. …to testing, but perhaps you could use something like this in tandem with some tests to pull it off? https://github.com/gvergnaud/ts-pattern
  9. …[1] is pretty good. [0] https://itnext.io/practical-introduction-to-algebraic-dataty... [1] https://github.com/gvergnaud/ts-pattern
    comment by iaml · 2021-08-23 · in Deno on MDN
  10. …use of new features in typescript 4.x to provide basically the full pattern matching experience: https://github.com/gvergnaud/ts-pattern
    comment by a_humean · 2021-05-14 · in Scala 3.0