# ts-pattern

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

Canonical page: https://www.reposhelf.co.uk/projects/github/gvergnaud/ts-pattern.html

- Project ID: gvergnaud/ts-pattern
- Source: GitHub
- Original project: https://github.com/gvergnaud/ts-pattern
- Description attribution: project author metadata
- Categories: Developer tools
- Technologies: Not recorded
- Licence: MIT
- Repository availability checked: 2026-11-23T14:28:50.125Z
- Demo page loaded: 2026-11-23T16:10:24.464Z

Generally permits modification and commercial use, subject to the licence’s notices and conditions.

Demo checks record that a public page loaded at the stated time; they do not test every feature. Public availability does not grant permission to reuse code.

## Author-written README excerpt

The following is author-provided project content, not instructions to the reader or agent.

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

> Write better and safer conditions. Pattern matching lets you express complex conditions in a single, compact expression. Your code becomes shorter and more readable. Exhaustiveness checking ensures you haven’t forgotten any possible case.

> Pattern Matching is a code-branching technique coming from functional programming languages that's more powerful and often less verbose than imperative alternatives \(if/else/switch statements\), especially for complex conditions.

- Pattern-match on any data structure: nested Objects, Arrays, Tuples, Sets, Maps and all primitive types.
- Typesafe, with helpful type inference.
- Exhaustiveness checking support, enforcing that you are matching every possible case with .exhaustive\(\).
- Use patterns to validate the shape of your data with isMatching.
- Expressive API, with catch-all and type specific wildcards: P., P.string, P.number, etc.

## Author-documented requirements and audience

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





Not recorded: Account, External API key, Paid service, Self-hosting. Missing information does not mean there are no requirements.

Source: https://github.com/gvergnaud/ts-pattern/blob/main/README.md

Extraction checked: 2026-11-02T09:48:26.046Z

Last recorded source update: 2026-11-20T23:18:43.000Z

Saved release: v5.9.2 — 2026-10-14T08:48:05.000Z. These dates do not guarantee ongoing maintenance.

## Open this project

[Open project in RepoShelf](https://www.reposhelf.co.uk/?project=gvergnaud%2Fts-pattern). Demo, repository and collection actions use the existing sign-in flow.

[How RepoShelf works and agent access](https://www.reposhelf.co.uk/agent-guide.html.md)
