Description
not able to narrow typestate types when subscribing to a state machine service
Expected Result
within a state.maches("foo") { ... } condition, types to be narrowed to the appropriate State type
Actual Result
types are not narrowed, you get the Context type

Reproduction
https://codesandbox.io/s/awesome-tree-qom29 (see src/index.ts L62)
Additional context
Fix for this coming 馃敎 but for now, this should be general a workaround:
if (state.matches<any>('something')) {
// ...
}
https://github.com/RafalFilipek/xstate-typestates-bug I've just updated my example. Still no luck. I think I'll wait for fix. I can live with that since we have optional chaining and nullish coalescing :)
Having same issue with useMachine from @xstate/react
Fix being released soon-ish: #868
Most helpful comment
Fix being released soon-ish: #868