Skip to content

Bug: xState v5 getSnapshot value does not have a type #4263

@ShravanSunder

Description

@ShravanSunder

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions