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. ▲ 2
    Ts-pattern – Pattern Matching library for TypeScript
    story by h4ch1 · 2026-03-14 · 0 comments
  3. …than a statement, so it can replace awkward terenaries. And it has no transitive dependencies! [1]: https://github.com/gvergnaud/ts-pattern
  4. 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
  5. …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
  6. …matching, but obviously has downsides that could be avoided if it was built into the language. https://github.com/gvergnaud/ts-pattern
  7. …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…
  8. ▲ 1
    Pattern Matching Library for TypeScript
    story by vincent_s · 2023-08-18 · 0 comments
  9. 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
  10. ▲ 2
    ts-pattern v5
    story by bpierre · 2023-06-13 · 0 comments
  11. …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
  12. ▲ 3
    The exhaustive Pattern Matching library for TypeScript with smart type inference
    story by itstaken · 2022-03-31 · 0 comments
  13. …[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
  14. ▲ 2
    ts-pattern: The exhaustive Pattern Matching library for TypeScript
    story by bpierre · 2021-08-01 · 0 comments
  15. …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