gvergnaud/ts-pattern
🎨 The exhaustive Pattern Matching library for TypeScript, with smart type inference. observed · 2026-08-28
Health v2 · maintenance only
78/100
- Activity 97
- Release rhythm 42
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: 56.0
- age_days: 2292
- days_rel: 311
- days_push: 23
- n_releases_24m: 9
Adoption not part of the score
15137 stars · 171 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-29, confidence not recorded
TS-Pattern is an exhaustive pattern matching library for TypeScript with smart type inference. It lets developers express complex branching conditions in a compact, typesafe way with compile-time exhaustiveness checking.
Use cases
- match on discriminated unions in typescript
- exhaustive switch handling for adts
- validate data shape with type-safe patterns
- replace nested if-else conditions with readable matching
- extract nested values from objects and arrays with patterns
When to choose
- you write typescript and want compile-time exhaustiveness checking over unions
- you want a tiny (~2kB) dependency-free branching utility
- you need type-safe data validation and selection in one expression
When to avoid
- you work in plain javascript without type checking
- you only need simple switch statements with few cases
- you need runtime schema validation with detailed error messages
Facets
library · maturity stable
type-system developer-tools programming-languages developer-tools frontend web-development browser pattern-matching type-inference exhaustiveness-checking adt typescript-library nodejs typescript javascript
2 sources
- readme: https://github.com/gvergnaud/ts-pattern · fetched 2026-08-28 · 9b43221aaae1
- registry_npm: https://registry.npmjs.org/ts-pattern · fetched 2026-08-29 · ff73a7bc8b8d
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| gvergnaud/ts-pattern | main | 78 |
For agents
markdown · JSON · MCP: product_card(name="gvergnaud/ts-pattern")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem