github statelyai/xstate xstate@5.0.0-beta.20

latest releases: @xstate/solid@0.2.3, @xstate/svelte@3.0.5, @xstate/vue@3.1.4...
pre-release15 months ago

Major Changes

  • #4036 e2440f0b1 Thanks @davidkpiano! - Actor types can now be specified in the .types property of createMachine:

    const fetcher = fromPromise(() => fetchUser());
    
    const machine = createMachine({
      types: {} as {
        actors: {
          src: 'fetchData'; // src name (inline behaviors ideally inferred)
          id: 'fetch1' | 'fetch2'; // possible ids (optional)
          logic: typeof fetcher;
        };
      },
      invoke: {
        src: 'fetchData', // strongly typed
        id: 'fetch2', // strongly typed
        onDone: {
          actions: ({ event }) => {
            event.output; // strongly typed as { result: string }
          }
        },
        input: { foo: 'hello' } // strongly typed
      }
    });

Minor Changes

  • #4157 31eb5f8a1 Thanks @Valkendorm! - Merge sendBack and receive with other properties of fromCallback logic creator.

    const callbackLogic = fromCallback(({ input, system, self, sendBack, receive }) => { ... });

Don't miss a new xstate release

NewReleases is sending notifications on new releases.