Back to library
Preview of ts-pattern
GitHub

Dev Utilities & Vibe-Coding Tooling · Type-safe TypeScript

ts-pattern

Exhaustive pattern matching for TypeScript with type narrowing, so unhandled union branches become compile errors instead of runtime bugs.

Why it’s a gem

Replaces nested ternaries and switch soup with something the compiler can prove complete.

Visit github.com
Type
GitHub repository
License
MIT
Added
Aug 17, 2026

More from Type-safe TypeScript