You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a strictly typed machine with the setup function, and adding event definitions, TS informs if we try to listen to an undefined event.
However, this behavior breaks when we try to listen to more than one event on the same state
(Bug) Expected result:
I am able to listen to more than one event per state, and still have TS guarantee that I am used pre-defined events
(Bug) Actual result:
Listening to more than one event per state stops TS from informing me of my using undefined events
Link to reproduction or proof-of-concept:
Here's a codesandbox of both the machine where TS shows an where listens to an undefined event (and shows a TS error), and another machine the same sate listens to more than one event, and fails to inform the vscode user of the fact that an undefined error is being listened to.
Alternatively, here's a snipper that can be pasted into local dev. The snippet shoud cause a TS error if it listens to an event not defined in the "types" object, but does not as long as more than one "on" event is listened to.
Bug or feature request?
Bug with xstate v5.13.2
Description:
When creating a strictly typed machine with the
setup
function, and adding event definitions, TS informs if we try to listen to an undefined event.However, this behavior breaks when we try to listen to more than one event on the same state
(Bug) Expected result:
I am able to listen to more than one event per state, and still have TS guarantee that I am used pre-defined events
(Bug) Actual result:
Listening to more than one event per state stops TS from informing me of my using undefined events
Link to reproduction or proof-of-concept:
Here's a codesandbox of both the machine where TS shows an where listens to an undefined event (and shows a TS error), and another machine the same sate listens to more than one event, and fails to inform the vscode user of the fact that an undefined error is being listened to.
Alternatively, here's a snipper that can be pasted into local dev. The snippet shoud cause a TS error if it listens to an event not defined in the "types" object, but does not as long as more than one "on" event is listened to.
The text was updated successfully, but these errors were encountered: