-
-
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
[v5] Actions refactor #2484
[v5] Actions refactor #2484
Conversation
Typing action and especially action meta was a problem in txstate, haven't checked but I think this is going to make it much much much easier, so super cool change :P |
Also I assume guards will also have params? |
Yes, action objects were previously a mess; this is going to make it much better.
Yes, guards have params 👍 |
That's great! |
Wait a min looked at the code, it's not exactly what I expected xD I was expecting type ActionObject = {
type: string,
exec?: ...,
- [k: string]: unknown
+ params: Record<string, unknown>
} The fact that out of all keys only Can we have my change? I know this would be breaking but I guess yours too is somewhat breaking? So if we're breaking things let's get them right. And the index signature on action object is problem not just for txstate but for xstate types too |
Which change is this? Should we only allow inline action objects like this? {
type: string;
params: { ... };
// no extra props
} |
This PR reworks actions so that there are "dynamic actions" and base action objects. This improves type inference for built-in actions, but also requires that parameterized actions have a
params
property: