Best practice for typing dynamic machine configs #5104
Unanswered
AlexZasorin
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm currently working on a project where I'm storing machine configs in a database. These machines can take any form so we don't know what states or events they may have. I'm currently working on trying to improve the typing for these configs and would like to ask what the best practice for this is.
I'm looking for a generic machine config type to use for typing the input and return data for my database, as well as my test fixtures. I attempted to use
UnknownMachineConfig
, but passing in something typed asUnknownMachineConfig
tocreateMachine
gives a TypeScript error.createMachine
seems to not acceptparams
in ParamterizedObject andid
in ProvidedActor being potentially undefined. I've gotten around this with:I'm not sure why I had to do this and it gives me the feeling that I'm approaching this wrong. Any advice?
Beta Was this translation helpful? Give feedback.
All reactions