# XState 5.22.0 - Product: XState (https://whatsnew.fyi/product/xstate) - Vendor: Stately - Date: 2025-09-18 - Version: 5.22.0 - Original notes: https://github.com/statelyai/xstate/releases/tag/xstate%405.22.0 - Permalink: https://whatsnew.fyi/product/xstate/releases/5.22.0 What's New is an index, not a publisher: every entry below links to the vendor's own release notes, which are the authoritative source. Entries are labelled where they are hand-curated sample data, pre-releases, or drawn from a secondary source such as a developer blog. Reuse: the summaries, labels and curation here are © What's New. Quote freely with attribution and a link back; wholesale republication of the corpus is not permitted — terms: https://whatsnew.fyi/terms. The vendors' own release notes remain their publishers'. --- - **added** — Add type-bound action helpers to setup(): createAction(fn) for creating type-safe custom actions, and setup-scoped helpers including assign(), sendTo(), raise(), log(), cancel(), stopChild(), enqueueActions(), emit(), and spawnChild() that are fully typed to the setup's context/events/actors/guards/delays/emitted ###### Minor Changes - [#5367](https://github.com/statelyai/xstate/pull/5367) [`76c857e`](https://github.com/statelyai/xstate/commit/76c857e36f4ae3fae4b410759fb4f420bae31388) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add type-bound action helpers to `setup()`: - `createAction(fn)` – create type-safe custom actions - `setup().assign(...)`, `setup().sendTo(...)`, `setup().raise(...)`, `setup().log(...)`, `setup().cancel(...)`, `setup().stopChild(...)`, `setup().enqueueActions(...)`, `setup().emit(...)`, `setup().spawnChild(...)` – setup-scoped helpers that are fully typed to the setup's context/events/actors/guards/delays/emitted. These helpers return actions that are bound to the specific `setup()` they were created from and can be used directly in the machine produced by that setup. ```ts const machineSetup = setup({ types: {} as { context: { count: number; }; events: { type: 'inc'; value: number } | { type: 'TEST' }; emitted: { type: 'PING' }; } }); // Custom action const action = machineSetup.createAction(({ context, event }) => { console.log(context.count, event.value); }); // Type-bound built-ins (no wrapper needed) const increment = machineSetup.assign({ count: ({ context }) => context.count + 1 }); const raiseTest = machineSetup.raise({ type: 'TEST' }); const ping = machineSetup.emit({ type: 'PING' }); const batch = machineSetup.enqueueActions(({ enqueue, check }) => { if (check(() => true)) { enqueue(increment); } }); const machine = machineSetup.createMachine({ context: { count: 0 }, entry: [action, increment, raiseTest, ping, batch] }); ```