github statelyai/xstate xstate@4.37.0

latest releases: @xstate/vue@4.0.0, @xstate/store@2.6.1, @xstate/svelte@4.0.0...
21 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.