ts-pattern
Fewer than 5 people recommend it so far, so there's no written verdict. Here is what commenters said.
3recommend
1warn against
Nov 23, 2025first mention
Oct 18, 2026latest mention
Why people recommend it
“you can do exhaustive pattern matching in TypeScript! https://github.com/gvergnaud/ts-pattern”
frontend developer preferring one language across the stackon “Java sealed classes and exhaustive pattern matching”
“I would highly recommend the ts-pattern [1] library if you find yourself wanting exhaustive switch statements!”
Caveats and dissent
“I don't think it's worth the external dependency and added complexity.”
Who recommends it in their own words
Threads where it came up
Data: ts-pattern.json. Quotes are verbatim; the verdict and theme labels are written by a model from these comments, and every clause links to its sources.
All comments 4
Isn't that overkill? You can check exhaustiveness with a trivial little helper: function exhaustive(witness: never): never { return witness } https://www.typescriptlang.org/play/?#code/FAFwngDgpgBAKgZQBYEsBOIEoF6wLwwBEAGgDKEwA+R5VRAshdYQocMAGYCuAdgMYgUAex4woADyQBDLgGdBANygAKAO4oQPKLNkAuGFqVoAlPsNQ0MAN7AYMNFBBc0o9Zu2zgAX3bd+gkRgQWVQMUigeAHMQJGVZHCh9RFDMBNMDLgBbACMLa1sYWTc+JBg4tPy7Oz4pWVgAcgR6-QcnFxgANgBOAG4C6tqG+mb7R2
“I don't think it's worth the external dependency and added complexity.”
“you can do exhaustive pattern matching in TypeScript! https://github.com/gvergnaud/ts-pattern”
“I would highly recommend the ts-pattern [1] library if you find yourself wanting exhaustive switch statements!”