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
I only have this occurring in my one machine and it's fairly difficult to reduce down to a easy reproduction as I couldn't figure out what was the same between the errors. I attached a Typescript playground illustrating the issue with the working actions/implementations commented out. (The typegen is amazing BTW, so much easier and I can remove a lot of checks, looking forward to a CLI tool ✨ )
Expected result
Event type should be correctly inferred for all actions/guards
Actual result
event is resolved to never in certain guards and actions.
Huh, this is quite interesting! So it seems that the issue is within our IndexByType helper that is used behind the scenes, see this TS playground. The issue here is that it doesn't process event types that are unions correctly.
A different version of this type works OK, see here. Key remapping for mapped types was introduced in TS 4.1 though so I need to rethink compatibility implications here or figure out a different filtering strategy than using Extract. For instance, an intersection works quite OK, see here.
Description
I only have this occurring in my one machine and it's fairly difficult to reduce down to a easy reproduction as I couldn't figure out what was the same between the errors. I attached a Typescript playground illustrating the issue with the working actions/implementations commented out. (The typegen is amazing BTW, so much easier and I can remove a lot of checks, looking forward to a CLI tool ✨ )
Expected result
Event type should be correctly inferred for all actions/guards
Actual result
event
is resolved tonever
in certain guards and actions.Reproduction
Typescript Playground Link
Additional context
xstate 4.30.3
The text was updated successfully, but these errors were encountered: