Download Latest Version v5.9.2 source code.zip (323.1 kB) Google Add to Preferred Sources
Home / v5.9.1
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2026-10-13 1.8 kB
v5.9.1 source code.tar.gz 2026-10-13 279.6 kB
v5.9.1 source code.zip 2026-10-13 319.5 kB
Totals: 3 Items   600.9 kB 0

Faster type checking

Large .exhaustive() matches type-check much faster. Fast paths for primitive patterns and an early exit for object patterns cut type instantiations by about 70-80% on big literal unions and about 35% on discriminated unions. This is the work of @gwkline in [#357], shipped through [#372]. Thank you Gavin!

  • literal union, 200 members: 788,205 → 240,909 instantiations (−69%)
  • literal union, 400 members: 2,470,005 → 447,609 (−82%)
  • discriminated union, 20 variants: 488,507 → 319,005 (−35%)

Error messages on invalid code

An invalid 2-argument .with() now reports "No overload matches this call" (TS2769). It is usually on the same spot as before. Two cases move it to the .with name: a pattern with 2+ invalid values (one error listing both), and a second argument that isn't a function. Valid code type-checks the same.

What's Changed

New Contributors

Full Changelog: https://github.com/gvergnaud/ts-pattern/compare/v5.9.0...v5.9.1

Source: README.md, updated 2026-10-13