Open danielkcz opened 3 years ago
Let's discuss this as a new issue and close #48 since it seems like a much more complicated problem.
The useActor alone has 3 overloads around some getSnapshot which I don't fully understand yet.
useActor
getSnapshot
https://github.com/davidkpiano/xstate/blob/07980daa33e6ea4094ca11ab4d25b23175104cb7/packages/xstate-react/src/useActor.ts#L30-L42
Then there is ActorRefFrom which can get ActorRef type based on the machine. That's currently incompatible with generated classes extended from StateNodeWithGeneratedTypes.
ActorRefFrom
ActorRef
StateNodeWithGeneratedTypes
https://github.com/davidkpiano/xstate/blob/07980daa33e6ea4094ca11ab4d25b23175104cb7/packages/core/src/types.ts#L1261-L1267
I can imagine we could ideally generate direct MachineIdActorRef types, but I am not sure how to approach that.
MachineIdActorRef
@mattpocock Can you please have a look at it and perhaps make a Loom again with hints?
Let's discuss this as a new issue and close #48 since it seems like a much more complicated problem.
The
useActor
alone has 3 overloads around somegetSnapshot
which I don't fully understand yet.https://github.com/davidkpiano/xstate/blob/07980daa33e6ea4094ca11ab4d25b23175104cb7/packages/xstate-react/src/useActor.ts#L30-L42
Then there is
ActorRefFrom
which can getActorRef
type based on the machine. That's currently incompatible with generated classes extended fromStateNodeWithGeneratedTypes
.https://github.com/davidkpiano/xstate/blob/07980daa33e6ea4094ca11ab4d25b23175104cb7/packages/core/src/types.ts#L1261-L1267
I can imagine we could ideally generate direct
MachineIdActorRef
types, but I am not sure how to approach that.@mattpocock Can you please have a look at it and perhaps make a Loom again with hints?