-
Hi! I am trying to add TypeScript to everything related to the state machine, almost everything works expect for TypeScript shows that the arguments for I have checked the types and it seems you will need some context along with the state, but in my case, I have no context at all. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Solved this way: export enum States {
DASHBOARD = 'DASHBOARD',
OVERVIEW = 'OVERVIEW'
}
type StatesMap<T> = {
[K in keyof T]: {
value: K,
context: never
}
}
export type TrainingStates = StatesMap<typeof States>[keyof StatesMap<typeof States>]; Added to https://gist.github.com/montogeek/dd51382ecc1d57a9ae9f6bad4c0b47df |
Beta Was this translation helpful? Give feedback.
Solved this way:
Added to https://gist.github.com/montogeek/dd51382ecc1d57a9ae9f6bad4c0b47df