Type Alias: Guard<TContext, TEvent>
API / @xmachines/play-xstate / Guard
type Guard<TContext, TEvent> = (args) => boolean;Defined in: packages/play-xstate/src/guards/types.ts:12
The standard signature of an XState guard function. A guard receives { context, event }.
Type Parameters
| Type Parameter | Default type |
|---|---|
TContext | Record<string, unknown> |
TEvent | PlayEvent |
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { context: TContext; event: TEvent; } | The arguments of the guard: the context and the event |
args.context | TContext | The current machine context |
args.event | TEvent | The event that started the evaluation of the guard |
Returns
boolean
The boolean value. It tells you if the guard passes
Deprecated
The next major version removes the guard utilities.