-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: [TypeScript] Unknown action when using enqueue()
and referencing an action defined with enqueueActions
#4820
Comments
This is a current limitation that we are facing. TS can't infer this situation correctly: TS playground |
Can a type assertion be used as a workaround? I'm not sure what it'd be. |
@Andarist I found another TS error: TS Playground setup({
actions: {
bar: enqueueActions(({ check }) => {
check(stateIn('a'));
}),
},
}).createMachine({
states: {
a: {},
b: {}
}
}); +1 to @boneskull, if there is a TS limitation are there utility types that can be exposed to help mitigate the issue via type assertions? |
FWIW Using Because of these TS limitations in setup, should I switch back to using Edit: Another alternative is to add |
Any updates? |
XState version
XState version 5
Description
Typescript errors when calling an action via
enqueue
when the action being called is defined withenqueueActions
.Expected result
Typescript should not error when calling
enqueue({ type: "bar" });
Actual result
Reproduction
https://codesandbox.io/p/devbox/currying-darkness-nvv5vh
Additional context
No response
The text was updated successfully, but these errors were encountered: