DEV Community

Discussion on: Bringing Pattern Matching to TypeScript 🎨 Introducing TS-Pattern

Collapse
 
mrvaa5eiym profile image
mrVAa5eiym • Edited

hi and thanks! how does this compare to Xstate in your opinion?

Collapse
 
gvergnaud profile image
Gabriel Vergnaud

Hi! IMO TS-Pattern and XState are complementary tools that aren't trying to solve the same problem:

  • XState is a state management library, trying to prevent invalid state transition from happening.
  • TS-Pattern is a control flow library, trying to make complex conditional expression easier to read and write, and trying to prevent unhandled cases.
Collapse
 
redbar0n profile image
Magne

How pattern matching relates to XState:

erikras.com/blog/finite-state-mach...

Related:
forum.rescript-lang.org/t/has-anyo...