I see the benefit here mostly for dynamic machines - if you know all of the actors up front, you might as well define them in setup() and get all the typing.
In my case, I have a large number of children, only some of which might get spawned at any given moment, and I'd like to keep them decoupled from the spawning machine (essentially, I have an interface that all the children adhere to, and I want to be able to add a new implementation and not have to update several places in code).
I could also see the benefit of loading and running machines from a remote store, where there's no knowledge at compile time of the types involved.
Maybe we can find some way to loosen this constraint (cc. @Andarist)
Originally posted by @davidkpiano in https://github.com/statelyai/xstate/issues/4566#issuecomment-2000165955
I see the benefit here mostly for dynamic machines - if you know all of the actors up front, you might as well define them in setup() and get all the typing.
In my case, I have a large number of children, only some of which might get spawned at any given moment, and I'd like to keep them decoupled from the spawning machine (essentially, I have an interface that all the children adhere to, and I want to be able to add a new implementation and not have to update several places in code).
I could also see the benefit of loading and running machines from a remote store, where there's no knowledge at compile time of the types involved.