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
20082026
-
…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
Ts-pattern – Pattern Matching library for TypeScriptstory by h4ch1 · 2026-03-14 · 0 comments
-
…than a statement, so it can replace awkward terenaries. And it has no transitive dependencies! [1]: https://github.com/gvergnaud/ts-pattern
comment by your_fin · 2025-11-23 · in `satisfies` is my favorite TypeScript keyword (2024) -
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 -
…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
comment by dcre · 2024-02-20 · in Building a hybrid native application with Gleam and Tauri -
…matching, but obviously has downsides that could be avoided if it was built into the language. https://github.com/gvergnaud/ts-pattern
comment by Stoids · 2024-02-09 · in React has grown beyond its original promise and it's causing more harm than good -
…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…
comment by vlakreeh · 2023-08-18 · in TypeScript is surprisingly ok for compilers -
▲ 1
Pattern Matching Library for TypeScriptstory by vincent_s · 2023-08-18 · 0 comments
-
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
comment by dejawu · 2023-08-18 · in TypeScript is surprisingly ok for compilers -
▲ 2
ts-pattern v5story by bpierre · 2023-06-13 · 0 comments
-
…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
comment by xeromal · 2022-11-05 · in Multiple assertions are fine in a unit test -
▲ 3
The exhaustive Pattern Matching library for TypeScript with smart type inferencestory by itstaken · 2022-03-31 · 0 comments
-
…[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 -
▲ 2
ts-pattern: The exhaustive Pattern Matching library for TypeScriptstory by bpierre · 2021-08-01 · 0 comments