Replies: 1 comment 1 reply
-
After digging through search results, I found out about If I add /** @internal */
const MyHugeMachine = setup(/* ... */).createMachine(/* ... */); ...it seems to get me out of the woods. These machines won't be part of the API surface, after all! These sort of errors seem to be specific to declaration file generation. I am kind of surprised that nobody has run into this before. Though--if most people using XState are building apps--maybe they aren't bothering to emit declarations? That said, this is definitely a band-aid; it doesn't address the root cause. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My app looks kind of like this:
Machines often send events from parent to child and vice-versa. To prevent cycles, I've had to move many types into their own modules.
The sad result of this architecture is that the inferred types of my machines become very large. The worst being the root machine, which looks to contain nearly every type in the entire system.
Here's an gist clearly illustrating the problem.
I didn't notice this was happening until I tried to upgrade to v5.16.0. Now, I'm running into issues where the root machine is simply too big to infer:
In addition, I'm seeing errors such as the following, for some of the larger machines (including the root machine):
I'm thinking I need to decouple the machines, but I'm not sure how to do this while maintaining a semblance of type safety. Maybe that looks like type omitting the
actors
prop when callingsetup()
, then using type assertions where appropriate?My questions:
Ref: #5046 (which I now believe is just "user error")
Beta Was this translation helpful? Give feedback.
All reactions