Skip to content

Conversation

Syth-1
Copy link

@Syth-1 Syth-1 commented Mar 4, 2025

Added a new flag 'scriptType' to state machine which provides different levels of typehint for states 'initial' and 'on' properties.

strictType can be:

  • "strict" : add type-hints and errors if types do not match, this will break some features eg spreading vars into the machine,
  • "loose" : adds type-hint but does not give errors when keys dont exist, as far as i know this keeps all compatibility,
  • undefined : no type-hint, the default behaviour if you do not provide a strictType param

I wasn't too sure how states inside states should work, so i made it scoped to the nested state you are currently on.

Copy link

changeset-bot bot commented Mar 4, 2025

🦋 Changeset detected

Latest commit: 16d17da

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
xstate Minor
@xstate/graph Major
@xstate/react Major
@xstate/solid Major
@xstate/svelte Major
@xstate/vue Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@davidkpiano davidkpiano requested a review from Andarist March 4, 2025 15:01
@Andarist
Copy link
Collaborator

Could you write down (with examples) what works and what doesn't with this? Which APIs have you considered? From what I can tell, at the very least, this forbids usage of deep patterns and IDs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants