useActorRef and ActorRefFrom usage with TypeScript #5146
Unanswered
erozum-bread
asked this question in
Q&A
Replies: 1 comment
-
To answer my own question, it turns out using multiple versions of xState was causing a type issue. When I removed xState 4 completely, my types worked as expected. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am migrating a project from xState 4 to 5. I am attempting to port my code over from useInterpret to useActorRef as the docs suggest. I am running into a type error when trying to return my actorRef using the following. I may be misunderstanding something as far as how to type this, but from what I can glean from the docs, this seems correct. Any help or clarification would be greatly appreciated.
Current versions:
"@xstate/react5": "npm:@xstate/react@5.0.0",
"xstate5": "npm:xstate@5.19.0",
The error output is
It seems to me that useActorRef returns an Actor, and not an ActorRef type. What would be the proper way to strongly type this context?
Beta Was this translation helpful? Give feedback.
All reactions