cassiozen / useStateMachine

The <1 kb state machine hook for React
MIT License
2.38k stars 47 forks source link

Event type as `never` if any state doesn't declare `on` #9

Closed cassiozen closed 3 years ago

cassiozen commented 3 years ago

on should be optional (final states, for one, won't have any transitions), but currently, if we create a config with any state missing the on key, the Event type turns to never.

This can be seen in the data fetching example: Try invoking send outside of the machine and you will get never as type.