ts-pattern
A type-safe pattern-matching library.
What it does
A type-safe pattern-matching library.
When it fits
Expressing structured branching with exhaustive matching over TypeScript values.
Other options in this category
- Effect — Structuring asynchronous work, errors, dependencies, and resource lifecycles.
- Total TypeScript TSConfig — Starting projects with consistent compiler settings.
- True Myth — Representing absence and failure explicitly in TypeScript application logic.
- ts-expect — Checking that public types behave as intended during compilation.
- ts-toolbelt — Building complex type transformations from reusable type-level operations.
Source
Project source for ts-pattern ↗
Editorial overview reviewed on October 24, 2026. Follow the source for current setup, compatibility, and licensing.