Minor Changes
-
#3835
431472082
Thanks @with-heart! - The newTagsFrom
helper type extracts the type oftags
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
returnsstring
:const machine = createMachine({ tags: ['a', 'b'], states: { idle: { tags: 'c' } } }); type Tags = TagsFrom<typeof machine>; // string