github statelyai/xstate xstate@5.0.0-beta.23

latest releases: @xstate/vue@4.0.0, @xstate/store@2.6.1, @xstate/svelte@4.0.0...
pre-release14 months ago

Minor Changes

  • #4180 6b1646ba8 Thanks @davidkpiano! - You can now specify action types for machines:

    createMachine({
      types: {} as {
        actions: { type: 'greet'; params: { name: string } };
      },
      entry: [
        {
          type: 'greet',
          params: {
            name: 'David'
          }
        },
        // @ts-expect-error
        { type: 'greet' },
        // @ts-expect-error
        { type: 'unknownAction' }
      ]
      // ...
    });
  • #4179 2b7548579 Thanks @davidkpiano! - Output types can now be specified in the machine:

    const machine = createMachine({
      types: {} as {
        output: {
          result: 'pass' | 'fail';
          score: number;
        };
      }
      // ...
    });
    
    const actor = createActor(machine);
    
    // ...
    
    const snapshot = actor.getSnapshot();
    
    if (snapshot.output) {
      snapshot.output.result;
      // strongly typed as 'pass' | 'fail'
      snapshot.output.score;
      // strongly typed as number
    }

Don't miss a new xstate release

NewReleases is sending notifications on new releases.