Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Strict Mode #47

Open
FraserTooth opened this issue Sep 6, 2021 · 0 comments
Open

Implement Strict Mode #47

FraserTooth opened this issue Sep 6, 2021 · 0 comments

Comments

@FraserTooth
Copy link

FraserTooth commented Sep 6, 2021

Implement "strict": True as an option in the machine configuration to allow a throw on a non-defined event for a given node. As it's a bit tricky to implement this external to the machine at present, e.g.:

# Doesn't throw
new_state = machine.transition(state=current_state, event="💩")

# Example of current check you'd have to do
if new_state.value == current_state.value:
    print("Didn't transition, maybe was an illegal state 🤷")

Similar to the implementation in the TS version of xstate https://github.com/statelyai/xstate/blob/8b7c3e2573341c5ed91057aab77e1977f8de8555/packages/core/src/StateNode.ts#L1095

Happy to take a crack at this if you think its worthwhile.

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

No branches or pull requests

1 participant