github statelyai/xstate xstate@4.37.0

latest releases: xstate@5.14.0, @xstate/store@1.0.0, xstate@5.13.2...
16 months ago

Minor Changes

  • #3835 431472082 Thanks @with-heart! - The new TagsFrom helper type extracts the type of tags from a state machine when typegen is enabled:

    const machine = createMachine({
      // `tags` attached to machine via typegen
      tsTypes: {} as import('./machine.typegen').Typegen0,
      tags: ['a', 'b'],
      states: {
        idle: { tags: 'c' }
      }
    });
    
    type Tags = TagsFrom<typeof machine>; // 'a' | 'b' | 'c'

    If typegen is not enabled, TagsFrom returns string:

    const machine = createMachine({
      tags: ['a', 'b'],
      states: {
        idle: { tags: 'c' }
      }
    });
    
    type Tags = TagsFrom<typeof machine>; // string

Patch Changes

Don't miss a new xstate release

NewReleases is sending notifications on new releases.