Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ShravanSunder opened this issue Sep 10, 2023 · 2 comments
Open

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

ShravanSunder opened this issue Sep 10, 2023 · 2 comments

Comments

@ShravanSunder
Copy link

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

@Andarist
Copy link
Member

This might become possible once we land: #4262

@davidkpiano
Copy link
Member

#4498

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants