Function: eventMatches()
API / @xmachines/play-xstate / eventMatches
function eventMatches<TEvent>(eventType): Guard<unknown, TEvent>;Defined in: packages/play-xstate/src/guards/helpers.ts:52
Tells you if the type of the event is the expected type
Type Parameters
| Type Parameter | Default type |
|---|---|
TEvent extends PlayEvent | PlayEvent |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventType | string | The expected event type |
Returns
Guard<unknown, TEvent>
The guard predicate. It tests the event type
Example
const machine = setup({ guards: { isSubmitEvent: eventMatches("submit"), isBackOrForward: composeGuardsOr([eventMatches("back"), eventMatches("forward")]), },});Deprecated
This function is part of the guard utilities, and the next major version removes them. Write a plain typed predicate instead.