Pattern matching for values that can be in one of several exclusive states.
Use when working with data where exactly one variant is active at a time - like operation results
that are either successful or failed, UI states that are loading, ready, or error, or any domain
model where alternatives are mutually exclusive.
The Status function lets you handle each state with a dedicated handler, while TypeScript
ensures all states are covered and values are accessed safely. Eliminates verbose conditional
logic and prevents bugs from unhandled cases.
Pattern matching for values that can be in one of several exclusive states.
Use when working with data where exactly one variant is active at a time - like operation results that are either successful or failed, UI states that are loading, ready, or error, or any domain model where alternatives are mutually exclusive.
The Status function lets you handle each state with a dedicated handler, while TypeScript ensures all states are covered and values are accessed safely. Eliminates verbose conditional logic and prevents bugs from unhandled cases.
Usage