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
Working with machine.transition() and other implementations of StateValue, the type is not provided. The type safety is provided elsewhere, ie state.matches:
TSVextendsTResolvedTypesMetaextendsTypegenEnabled
? Prop<Prop<TResolvedTypesMeta,'resolved'>,'matchesStates'>
: never
It would be great to see this applied more broadly.
Expected result
Here is an example implementation with a generic StateValue. Naturally a lot of this code is to get at the typegen that would be already available within the StateNode class.
That's unfortunately not necessarily true. Remember that TS still doesn't support partial inference. This particular issue mentions that it's using typegen and with that, we could revamp this PR at some point: statelyai/xstate-tools#160
Description
Working with
machine.transition()
and other implementations ofStateValue
, the type is not provided. The type safety is provided elsewhere, ie state.matches:It would be great to see this applied more broadly.
Expected result
Here is an example implementation with a generic
StateValue
. Naturally a lot of this code is to get at the typegen that would be already available within theStateNode
class.Actual result
Reproduction
https://codesandbox.io/s/xstate-typescript-demo-le9xqo?file=/src/index.ts
Additional context
No response
The text was updated successfully, but these errors were encountered: