xstate
xstate copied to clipboard
Bug: xState v5 getSnapshot value does not have a type
Description
getSnapshot().value does not have a type
export interface StateValueMap {
[key: string]: StateValue;
}
/**
* The string or object representing the state value relative to the parent state node.
*
* - For a child atomic state node, this is a string, e.g., `"pending"`.
* - For complex state nodes, this is an object, e.g., `{ success: "someChildState" }`.
*/
export type StateValue = string | StateValueMap;
The snapshot.matches() isn't typed because of this
Expected result
- state should be typed based on MachineConfig states
- matches should be typed based on MachineConfig states
Actual result
no types
Reproduction
n/a
Additional context
No response
This might become possible once we land: https://github.com/statelyai/xstate/pull/4262
#4498