@systemfsoftware/xstate 0.0.0-stage → 6.0.0-beta.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,641 @@
1
- # Temporary Holding Version
1
+ > `@systemfsoftware/xstate` is forked from [statelyai/xstate](https://github.com/statelyai/xstate) (`packages/core`, branch `next` at `2146ae26ebfc7e6a624b3a1f237f9e6ddc30b9f5`), MIT. The text below is upstream's.
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <p align="center">
4
+ <br />
5
+
6
+ <picture>
7
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/statelyai/public-assets/main/logos/xstate-logo-white-nobg.svg">
8
+ <img alt="XState logotype" src="https://raw.githubusercontent.com/statelyai/public-assets/main/logos/xstate-logo-black-nobg.svg" width="200">
9
+ </picture>
10
+ <br />
11
+ <strong>Actor-based state management & orchestration for complex app logic.</strong> <a href="https://stately.ai/docs">→ Documentation</a>
12
+ <br />
13
+ <br />
14
+ </p>
15
+
16
+ <!-- runtime dependencies and public entry points from package.json -->
17
+
18
+ XState is a state management and orchestration solution for JavaScript and TypeScript apps. The `xstate` package has _zero_ runtime dependencies. XState is useful for frontend and backend application logic.
19
+
20
+ It uses event-driven programming, state machines, statecharts, and the actor model to handle complex logic in predictable, robust, and visual ways. XState provides a powerful and flexible way to manage application and workflow state by allowing developers to model logic as actors and state machines.
21
+
22
+ <!-- experimental whole-system transitions from packages/core/src/systemTransition.ts -->
23
+
24
+ For pure actor-system simulation, `initialSystemTransition`, `systemTransition`
25
+ and `advanceSystemTime` return an immutable system snapshot and external effects
26
+ as data. Branch or replay actors, messages and virtual timers without starting live
27
+ actors. See [pure system transitions](../../docs/system-transitions.md).
28
+
29
+ <!-- durable execution and checkpoint restoration from packages/core/src/durable/index.ts -->
30
+
31
+ For durable hosts, the experimental `xstate/durable` entry point provides
32
+ `createDurable`. Resume a checkpoint with `execution.restore(persistedSnapshot)`
33
+ and execute the returned effects to restart active embedded children and pending
34
+ timers without replaying entry actions. Await `executeEffects()` before persisting
35
+ to retain accepted timer deadlines. The host handles root error snapshots;
36
+ `run()` rejects with the root error. See [durable execution](../../docs/durable-execution.md).
37
+
38
+ <!-- typed inline invocation from packages/core/src/setup.ts -->
39
+
40
+ Use `s.createInvoke({ src, input, onDone })` inline in `s.createMachine(...)` for an actor used in one state. It infers the actor's input and output and the enclosing state's narrowed context without registering that actor in `setup.actors`. See [typed inline invokes](../../docs/invoke.md#typed-inline-invokes).
41
+
42
+ Pass an async function directly as `src`, with `schemas.input`, `schemas.output`, and `schemas.error` on the same invoke. Output also infers from the async return when its schema is omitted. Existing logic values use their own schemas.
43
+
44
+ The helper requires input for actors whose input excludes `undefined`, and checks child IDs and source compatibility against `schemas.children` declared in the setup or machine.
45
+
46
+ For flat finite state machines, `xstate/fsm` provides a tiny pure transition
47
+ table with context and TypeScript support:
48
+
49
+ <!-- public exports from packages/core/src/fsm/index.ts; exact capabilities documented in docs/fsm.md -->
50
+
51
+ ```ts
52
+ import { createFSM } from 'xstate/fsm'
53
+
54
+ const machine = createFSM({
55
+ initial: 'inactive',
56
+ states: {
57
+ inactive: { on: { toggle: 'active' } },
58
+ active: { on: { toggle: 'inactive' } },
59
+ },
60
+ })
61
+
62
+ let state = machine.initialState
63
+ ;[state] = machine.transition(state, { type: 'toggle' })
64
+ ```
65
+
66
+ The FSM is also actor logic, so `createActor(machine)` from `xstate` runs it.
67
+
68
+ For typed context, event payloads, or state-specific context snapshots, use
69
+ `setup` and `types` from `xstate/fsm`. These schemas are type-only in this
70
+ subpath; use root `xstate` for runtime schema validation.
71
+
72
+ See the [exact supported surface](https://stately.ai/docs/fsm). Use the root `xstate`
73
+ entry point for compound or parallel statecharts, invocation, named sources,
74
+ runtime schemas, serialization and inspection.
75
+
76
+ ### ✨ Create state machines visually in Stately Studio → [state.new](https://state.new)
77
+
78
+ ---
79
+
80
+ 📖 [Read the documentation](https://stately.ai/docs)
81
+
82
+ ➡️ [Create state machines with the Stately Editor](https://stately.ai/editor)
83
+
84
+ 🖥 [Download our VS Code extension](https://marketplace.visualstudio.com/items?itemName=statelyai.stately-vscode)
85
+
86
+ 📑 Inspired by the [SCXML specification](https://www.w3.org/TR/scxml/)
87
+
88
+ <!-- public SCXML entry point from packages/xstate-scxml/src/index.ts -->
89
+
90
+ Create machines from SCXML documents with the separate [`@xstate/scxml`](../xstate-scxml) package. See the [SCXML guide](../../docs/scxml.md).
91
+
92
+ 💬 Chat on the [Stately Discord Community](https://discord.gg/xstate)
93
+
94
+ ✍️ Browse through the many [XState examples](https://github.com/statelyai/xstate/tree/main/examples)
95
+
96
+ ## Templates
97
+
98
+ Get started by forking one of these templates on CodeSandbox:
99
+
100
+ <table>
101
+ <thead>
102
+ <tr><th>Template</th><th></th></tr>
103
+ </thead>
104
+ <tbody>
105
+
106
+ <tr>
107
+ <td>
108
+
109
+ [🤖 XState Template (CodeSandbox)](https://codesandbox.io/p/devbox/github/statelyai/xstate/tree/main/templates/vanilla-ts)
110
+
111
+ [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/statelyai/xstate/tree/main/templates/vanilla-ts?file=%2Fsrc%2FfeedbackMachine.ts)
112
+
113
+ </td>
114
+ <td>
115
+
116
+ - XState v5
117
+ - TypeScript
118
+ - _No framework_
119
+
120
+ </td>
121
+ </tr>
122
+
123
+ <tr>
124
+ <td>
125
+
126
+ [⚛️ XState + React Template (CodeSandbox)](https://codesandbox.io/p/devbox/github/statelyai/xstate/tree/main/templates/react-ts)
127
+
128
+ [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/statelyai/xstate/tree/main/templates/react-ts?file=%2Fsrc%2FfeedbackMachine.ts)
129
+
130
+ </td>
131
+ <td>
132
+
133
+ - [React](https://react.dev/)
134
+ - XState v5
135
+ - TypeScript
136
+
137
+ </td>
138
+ </tr>
139
+
140
+ <tr>
141
+ <td>
142
+
143
+ [💚 XState + Vue Template (CodeSandbox)](https://codesandbox.io/p/devbox/github/statelyai/xstate/tree/main/templates/vue-ts)
144
+
145
+ [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/statelyai/xstate/tree/main/templates/vue-ts?file=%2Fsrc%2FfeedbackMachine.ts)
146
+
147
+ </td>
148
+ <td>
149
+
150
+ - [Vue](https://vuejs.org/)
151
+ - XState v5
152
+ - TypeScript
153
+
154
+ </td>
155
+ </tr>
156
+
157
+ <tr>
158
+ <td>
159
+
160
+ [🧡 XState + Svelte Template (CodeSandbox)](https://codesandbox.io/p/devbox/github/statelyai/xstate/tree/main/templates/svelte-ts)
161
+
162
+ [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/statelyai/xstate/tree/main/templates/svelte-ts?file=%2Fsrc%2FfeedbackMachine.ts)
163
+
164
+ </td>
165
+ <td>
166
+
167
+ - [Svelte](https://svelte.dev/)
168
+ - XState v5
169
+ - TypeScript
170
+
171
+ </td>
172
+ </tr>
173
+
174
+ </tbody>
175
+ </table>
176
+
177
+ ## Super quick start
178
+
179
+ ```bash
180
+ nix build github:systemfsoftware/xstate#xstate
181
+ ```
182
+
183
+ See the root README's [Install](../../README.md#install) section for wiring a catalog entry.
184
+
185
+ ```ts
186
+ import { createActor, createMachine } from 'xstate'
187
+
188
+ // State machine
189
+ const toggleMachine = createMachine({
190
+ id: 'toggle',
191
+ initial: 'inactive',
192
+ context: {
193
+ count: 0,
194
+ },
195
+ states: {
196
+ inactive: {
197
+ on: {
198
+ TOGGLE: { target: 'active' },
199
+ },
200
+ },
201
+ active: {
202
+ entry: ({ context }) => ({
203
+ context: { count: context.count + 1 },
204
+ }),
205
+ on: {
206
+ TOGGLE: { target: 'inactive' },
207
+ },
208
+ },
209
+ },
210
+ })
211
+
212
+ // Actor (instance of the machine logic, like a store)
213
+ const toggleActor = createActor(toggleMachine)
214
+ toggleActor.subscribe((state) => console.log(state.value, state.context))
215
+ toggleActor.start()
216
+ // => logs 'inactive', { count: 0 }
217
+
218
+ toggleActor.send({ type: 'TOGGLE' })
219
+ // => logs 'active', { count: 1 }
220
+
221
+ toggleActor.send({ type: 'TOGGLE' })
222
+ // => logs 'inactive', { count: 1 }
223
+ ```
224
+
225
+ ## [Stately Studio](https://stately.ai)
226
+
227
+ - Visually create, edit, and collaborate on state machines
228
+ - Export to many formats, including XState v5
229
+ - Test path & documentation autogeneration
230
+ - Deploy to Stately Sky
231
+ - Generate & modify machines with Stately AI
232
+
233
+ <a href="https://stately.ai/registry/new?ref=github" title="Stately Studio">
234
+ <img src="https://github.com/statelyai/xstate/assets/1093738/74ed9cbc-b824-4ed7-a16d-f104947af8a7" alt="XState Viz" width="800" />
235
+ </a>
236
+
237
+ **[state.new](https://stately.ai/registry/new?ref=github)**
238
+
239
+ ## Why?
240
+
241
+ Statecharts are a formalism for modeling stateful, reactive systems. This is useful for declaratively describing the _behavior_ of your application, from the individual components to the overall application logic.
242
+
243
+ Read [📽 the slides](http://slides.com/davidkhourshid/finite-state-machines) ([🎥 video](https://www.youtube.com/watch?v=VU1NKX6Qkxc)) or check out these resources for learning about the importance of finite state machines and statecharts in user interfaces:
244
+
245
+ - [Statecharts - A Visual Formalism for Complex Systems](https://www.sciencedirect.com/science/article/pii/0167642387900359/pdf) by David Harel
246
+ - [The World of Statecharts](https://statecharts.github.io/) by Erik Mogensen
247
+
248
+ ## Packages
249
+
250
+ | Package | Description |
251
+ | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
252
+ | 🤖 `xstate` | Core finite state machine and statecharts library + interpreter |
253
+ | [⚛️ `@xstate/react`](https://github.com/statelyai/xstate/tree/main/packages/xstate-react) | React hooks and utilities for using XState in React applications |
254
+ | [💚 `@xstate/vue`](https://github.com/statelyai/xstate/tree/main/packages/xstate-vue) | Vue composition functions and utilities for using XState in Vue applications |
255
+ | [🎷 `@xstate/svelte`](https://github.com/statelyai/xstate/tree/main/packages/xstate-svelte) | Svelte utilities for using XState in Svelte applications |
256
+ | [🥏 `@xstate/solid`](https://github.com/statelyai/xstate/tree/main/packages/xstate-solid) | Solid hooks and utilities for using XState in Solid applications |
257
+
258
+ ## Finite State Machines
259
+
260
+ <table>
261
+ <thead><tr><th>Code</th><th>Statechart</th></tr></thead>
262
+ <tbody>
263
+ <tr>
264
+ <td>
265
+
266
+ ```js
267
+ import { createActor, createMachine } from 'xstate'
268
+
269
+ const lightMachine = createMachine({
270
+ id: 'light',
271
+ initial: 'green',
272
+ states: {
273
+ green: {
274
+ on: {
275
+ TIMER: 'yellow',
276
+ },
277
+ },
278
+ yellow: {
279
+ on: {
280
+ TIMER: 'red',
281
+ },
282
+ },
283
+ red: {
284
+ on: {
285
+ TIMER: 'green',
286
+ },
287
+ },
288
+ },
289
+ })
290
+
291
+ const actor = createActor(lightMachine)
292
+
293
+ actor.subscribe((state) => {
294
+ console.log(state.value)
295
+ })
296
+
297
+ actor.start()
298
+ // logs 'green'
299
+
300
+ actor.send({ type: 'TIMER' })
301
+ // logs 'yellow'
302
+ ```
303
+
304
+ <table>
305
+ <thead><tr><th>Code</th><th>Statechart</th></tr></thead>
306
+ <tbody>
307
+ <tr>
308
+ <td>
309
+
310
+ </td>
311
+ <td>
312
+
313
+ </td>
314
+ </tr>
315
+ </tbody>
316
+ </table>
317
+
318
+ </td>
319
+ <td>
320
+
321
+ <a href="https://stately.ai/registry/editor/fa443471-b416-4014-8e6f-12417863e4d4?mode=design&machineId=27e86036-f2f7-40f1-9d1e-66ce6e1accc0" title="Finite states">
322
+ <img src="https://github.com/statelyai/xstate/assets/1093738/36d4b6b5-e3d0-4c19-9f41-2e3425ceac88" alt="Finite states" width="400" />
323
+ <br />
324
+ Open in Stately Studio
325
+ </a>
326
+ <br />
327
+
328
+ </td>
329
+ </tbody>
330
+ </table>
331
+
332
+ ## Hierarchical (Nested) State Machines
333
+
334
+ <table>
335
+ <thead><tr><th>Code</th><th>Statechart</th></tr></thead>
336
+ <tbody>
337
+ <tr>
338
+ <td>
339
+
340
+ ```js
341
+ import { createActor, createMachine } from 'xstate'
342
+
343
+ const pedestrianStates = {
344
+ initial: 'walk',
345
+ states: {
346
+ walk: {
347
+ on: {
348
+ PED_TIMER: 'wait',
349
+ },
350
+ },
351
+ wait: {
352
+ on: {
353
+ PED_TIMER: 'stop',
354
+ },
355
+ },
356
+ stop: {},
357
+ },
358
+ }
359
+
360
+ const lightMachine = createMachine({
361
+ id: 'light',
362
+ initial: 'green',
363
+ states: {
364
+ green: {
365
+ on: {
366
+ TIMER: 'yellow',
367
+ },
368
+ },
369
+ yellow: {
370
+ on: {
371
+ TIMER: 'red',
372
+ },
373
+ },
374
+ red: {
375
+ on: {
376
+ TIMER: 'green',
377
+ },
378
+ ...pedestrianStates,
379
+ },
380
+ },
381
+ })
382
+
383
+ const actor = createActor(lightMachine)
384
+
385
+ actor.subscribe((state) => {
386
+ console.log(state.value)
387
+ })
388
+
389
+ actor.start()
390
+ // logs 'green'
391
+
392
+ actor.send({ type: 'TIMER' })
393
+ // logs 'yellow'
394
+
395
+ actor.send({ type: 'TIMER' })
396
+ // logs { red: 'walk' }
397
+
398
+ actor.send({ type: 'PED_TIMER' })
399
+ // logs { red: 'wait' }
400
+ ```
401
+
402
+ </td>
403
+ <td>
404
+ <a href="https://stately.ai/registry/editor/fa443471-b416-4014-8e6f-12417863e4d4?mode=design&machineId=30dffcdd-16c2-49e2-bfc6-a674057cb271" title="Hierarchical states">
405
+ <img src="https://github.com/statelyai/xstate/assets/1093738/32b0692b-1c29-4469-b5e3-03146e3ef249" alt="Hierarchical states" width="400" />
406
+ <br />
407
+ Open in Stately Studio
408
+ </a>
409
+ <br />
410
+ </td>
411
+ </tr>
412
+ </tbody>
413
+ </table>
414
+
415
+ ## Parallel State Machines
416
+
417
+ <table>
418
+ <thead><tr><th>Code</th><th>Statechart</th></tr></thead>
419
+ <tbody>
420
+ <tr>
421
+ <td>
422
+
423
+ ```ts
424
+ import { createActor, createMachine } from 'xstate'
425
+
426
+ const wordMachine = createMachine({
427
+ id: 'word',
428
+ type: 'parallel',
429
+ states: {
430
+ bold: {
431
+ initial: 'off',
432
+ states: {
433
+ on: {
434
+ on: { TOGGLE_BOLD: { target: 'off' } },
435
+ },
436
+ off: {
437
+ on: { TOGGLE_BOLD: { target: 'on' } },
438
+ },
439
+ },
440
+ },
441
+ underline: {
442
+ initial: 'off',
443
+ states: {
444
+ on: {
445
+ on: { TOGGLE_UNDERLINE: { target: 'off' } },
446
+ },
447
+ off: {
448
+ on: { TOGGLE_UNDERLINE: { target: 'on' } },
449
+ },
450
+ },
451
+ },
452
+ italics: {
453
+ initial: 'off',
454
+ states: {
455
+ on: {
456
+ on: { TOGGLE_ITALICS: { target: 'off' } },
457
+ },
458
+ off: {
459
+ on: { TOGGLE_ITALICS: { target: 'on' } },
460
+ },
461
+ },
462
+ },
463
+ list: {
464
+ initial: 'none',
465
+ states: {
466
+ none: {
467
+ on: {
468
+ BULLETS: { target: 'bullets' },
469
+ NUMBERS: { target: 'numbers' },
470
+ },
471
+ },
472
+ bullets: {
473
+ on: {
474
+ NONE: { target: 'none' },
475
+ NUMBERS: { target: 'numbers' },
476
+ },
477
+ },
478
+ numbers: {
479
+ on: {
480
+ BULLETS: { target: 'bullets' },
481
+ NONE: { target: 'none' },
482
+ },
483
+ },
484
+ },
485
+ },
486
+ },
487
+ })
488
+
489
+ const actor = createActor(wordMachine)
490
+
491
+ actor.subscribe((state) => {
492
+ console.log(state.value)
493
+ })
494
+
495
+ actor.start()
496
+ // logs {
497
+ // bold: 'off',
498
+ // italics: 'off',
499
+ // underline: 'off',
500
+ // list: 'none'
501
+ // }
502
+
503
+ actor.send({ type: 'TOGGLE_BOLD' })
504
+ // logs {
505
+ // bold: 'on',
506
+ // italics: 'off',
507
+ // underline: 'off',
508
+ // list: 'none'
509
+ // }
510
+
511
+ actor.send({ type: 'TOGGLE_ITALICS' })
512
+ // logs {
513
+ // bold: 'on',
514
+ // italics: 'on',
515
+ // underline: 'off',
516
+ // list: 'none'
517
+ // }
518
+ ```
519
+
520
+ </td>
521
+ <td>
522
+ <a href="https://stately.ai/registry/editor/fa443471-b416-4014-8e6f-12417863e4d4?mode=design&machineId=980f50d8-e1ff-4441-8c8b-afe41c1610f2" title="Parallel states">
523
+ <img src="https://github.com/statelyai/xstate/assets/1093738/3b1989c0-f4a9-4653-baf2-4df3a40e91a6" alt="Parallel states" width="400" />
524
+ <br />
525
+ Open in Stately Studio
526
+ </a>
527
+ </td>
528
+ </tr>
529
+ </tbody>
530
+ </table>
531
+
532
+ ## History States
533
+
534
+ <table>
535
+ <thead><tr><th>Code</th><th>Statechart</th></tr></thead>
536
+ <tbody>
537
+ <tr>
538
+ <td>
539
+
540
+ ```js
541
+ import { createActor, createMachine } from 'xstate'
542
+
543
+ const paymentMachine = createMachine({
544
+ id: 'payment',
545
+ initial: 'method',
546
+ states: {
547
+ method: {
548
+ initial: 'cash',
549
+ states: {
550
+ cash: {
551
+ on: {
552
+ SWITCH_CHECK: 'check',
553
+ },
554
+ },
555
+ check: {
556
+ on: {
557
+ SWITCH_CASH: 'cash',
558
+ },
559
+ },
560
+ hist: { type: 'history' },
561
+ },
562
+ on: { NEXT: { target: 'review' } },
563
+ },
564
+ review: {
565
+ on: { PREVIOUS: { target: 'method.hist' } },
566
+ },
567
+ },
568
+ })
569
+
570
+ const actor = createActor(paymentMachine)
571
+
572
+ actor.subscribe((state) => {
573
+ console.log(state.value)
574
+ })
575
+
576
+ actor.start()
577
+ // logs {
578
+ // value: { method: 'cash' },
579
+ // }
580
+
581
+ actor.send({ type: 'SWITCH_CHECK' })
582
+ // logs {
583
+ // value: { method: 'check' },
584
+ // }
585
+
586
+ actor.send({ type: 'NEXT' })
587
+ // logs {
588
+ // value: 'review',
589
+ // }
590
+
591
+ actor.send({ type: 'PREVIOUS' })
592
+ // logs {
593
+ // value: { method: 'check' },
594
+ // }
595
+ ```
596
+
597
+ </td>
598
+ <td>
599
+ <a href="https://stately.ai/registry/editor/fa443471-b416-4014-8e6f-12417863e4d4?mode=design&machineId=d1a9bb95-db97-4af3-b38b-71b005c643d3" title="History states">
600
+ <img src="https://github.com/statelyai/xstate/assets/1093738/1be5c495-d560-4660-94f2-5341efbf7128" alt="History state" width="400" />
601
+ <br />
602
+ Open in Stately Studio
603
+ </a>
604
+ </td>
605
+ </tr>
606
+ </tbody>
607
+ </table>
608
+
609
+ ## Sponsors
610
+
611
+ Special thanks to the sponsors who support this open-source project:
612
+
613
+ <img src="https://opencollective.com/xstate/tiers/backer/badge.svg?label=sponsors&color=brightgreen" />
614
+
615
+ <a href="https://transloadit.com/?utm_source=xstate&utm_medium=referral&utm_campaign=sponsorship&utm_content=github">
616
+ <picture>
617
+ <source media="(prefers-color-scheme: dark)" srcset="https://assets.transloadit.com/assets/images/sponsorships/logo-dark.svg">
618
+ <source media="(prefers-color-scheme: light)" srcset="https://assets.transloadit.com/assets/images/sponsorships/logo-default.svg">
619
+ <img src="https://assets.transloadit.com/assets/images/sponsorships/logo-default.svg" alt="Transloadit Logo">
620
+ </picture>
621
+ </a>
622
+
623
+ ## SemVer Policy
624
+
625
+ We understand the importance of the public contract and do not intend to release any breaking changes to the **runtime** API in a minor or patch release. We consider this with any changes we make to the XState libraries and aim to minimize their effects on existing users.
626
+
627
+ ### Breaking changes
628
+
629
+ XState executes much of the user logic itself. Therefore, almost any change to its behavior might be considered a breaking change. We recognize this as a potential problem but believe that treating every change as a breaking change is not practical. We do our best to implement new features thoughtfully to enable our users to implement their logic in a better, safer way.
630
+
631
+ Any change _could_ affect how existing XState machines behave if those machines are using particular configurations. We do not introduce behavior changes on a whim and aim to avoid making changes that affect most existing machines. But we reserve the right to make _some_ behavior changes in minor releases. Our best judgment of the situation will always dictate such changes. Please always read our release notes before deciding to upgrade.
632
+
633
+ ### TypeScript changes
634
+
635
+ We also reserve a similar right to adjust declared TypeScript definitions or drop support for older versions of TypeScript in a minor release. The TypeScript language itself evolves quickly and often introduces breaking changes in its minor releases. Our team is also continuously learning how to leverage TypeScript more effectively - and the types improve as a result.
636
+
637
+ For these reasons, it is impractical for our team to be bound by decisions taken when an older version of TypeScript was its latest version or when we didn’t know how to declare our types in a better way. We won’t introduce declaration changes often - but we are more likely to do so than with runtime changes.
638
+
639
+ ### Packages
640
+
641
+ Most of the packages in the XState family declare a peer dependency on XState itself. We’ll be cautious about maintaining compatibility with already-released packages when releasing a new version of XState, **but** each release of packages depending on XState will always adjust the declared peer dependency range to include the latest version of XState. For example, you should always be able to update `xstate` without `@xstate/react`. But when you update `@xstate/react`, we highly recommend updating `xstate` too.