Class MatchBuilder<T, R, HasInput, Handled, Locked>
Fluent builder for match. Tracks the handled cases at the type
level so .exhaustive() only compiles when every union member is covered.
The Locked phantom flag (set via .returnType<R>()) constrains every
subsequent handler to return R, useful when branch return-type
inference would widen to a union narrower than the target slot
(e.g. ReactNode, an API DTO).
Lock the result type. All subsequent .with() handlers must return R2.
Useful when branch return-type inference widens to a union narrower than
the slot the match feeds into (e.g. ReactNode).
Fluent builder for match. Tracks the handled cases at the type level so
.exhaustive()only compiles when every union member is covered.The
Lockedphantom flag (set via.returnType<R>()) constrains every subsequent handler to returnR, useful when branch return-type inference would widen to a union narrower than the target slot (e.g.ReactNode, an API DTO).Example