0

At the moment I do it like this:

useActor<SomeInterpreter>((state as any).children.SomeChild);

Since I'm not a big fan of "any" in TypeScript, is there another way of doing this?

romano
  • 1
  • 3
  • `useActor` should be able to infer the type automatically based on the input arguments. Since you used `state as any`, this is not possible. So, what are you trying to accomplish in the first place? (https://xyproblem.info/) Also, could you provide more context on what kind of state object you are passing? If you would create a [MCVE](https://stackoverflow.com/help/minimal-reproducible-example) project on a platform like Codesandbox, it would be easier for others to help you. – Tobi Obeck Nov 26 '21 at 15:38

1 Answers1

0

At the moment of this comment this is not possible, according to David Khourshid. they will add a better way in the future.

romano
  • 1
  • 3
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 30 '21 at 20:52