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: type errors for actions, guards, etc. from stately-generated machines #5164

Open
jlengstorf opened this issue Jan 1, 2025 · 0 comments
Labels

Comments

@jlengstorf
Copy link

XState version

XState version 5

Description

I grabbed the code generated by stately for this machine: https://stately.ai/registry/editor/26c77e49-1ea2-4dcc-b523-a8e185b38fd7?machineId=d1bc8e28-9e9c-4df6-a0f6-25e082e55f9a&mode=Design

VS Code is showing type errors for actions (e.g. the type property is being flagged as invalid), guards, and a few other unexpected pieces of the machine.

Screenshot 2025-01-01 at 13 41 40

Screenshot 2025-01-01 at 14 06 11

I'm not great at reading TS errors, but this looks like it's trying to use the context type for validating actions and guards.

Expected result

I expected the code generated by Stately to work without type errors.

Actual result

Type inference seems to be a bit weird.

Reproduction

Copy the code from https://stately.ai/registry/editor/26c77e49-1ea2-4dcc-b523-a8e185b38fd7?machineId=d1bc8e28-9e9c-4df6-a0f6-25e082e55f9a&mode=Design into a new project and see the state machine type errors.

Additional context

No response

@jlengstorf jlengstorf added the bug label Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant