Pattern matcher.
Accepts handlers for each condition and returns the result from the matched handler. Three usage patterns are supported:
R
R | undefined
The conditions type defining all possible condition variants
Handles all conditions with complete handlers.
The return type of all handlers
Mapping of all condition keys to their handlers
The result from the matched handler
Handles some conditions without a fallback.
Partial mapping of condition keys to handlers
The result from the matched handler, or undefined if no handler matched
undefined
Handles some conditions with a fallback handler for unmatched conditions.
Fallback handler receiving union of condition values
The result from the matched handler or fallback
Pattern matcher.
Accepts handlers for each condition and returns the result from the matched handler. Three usage patterns are supported:
RRR | undefined