We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Would be awesome to have Typescript definitions.
The text was updated successfully, but these errors were encountered:
Yeah ... that will be really nice. Unfortunately I have 0 experience with TypeScript. PRs are of course welcome.
Sorry, something went wrong.
I've possible to add your own types, here an example:
// Transitions: export enum SCREENS { IDLE = "screen_idle", LOGIN_DETAILS = "screen_login_details", } // Machine State type MachineState = { name: SCREENS; step: number; }; // Machine interface export interface MachineProps { name: string; state: MachineState; isScreenLoginDetails: () => boolean; isScreenIdle: () => boolean; advance: () => null; } // Your methods export const advance = (machine: MachineProps): MachineState => { // Return the new state... return state; }; // Constructor export const makeMachine = (): MachineProps => { const initialState: MachineState = { name: SCREENS.IDLE, step: 1 }; return Machine.create("my-machine-name", { state: initialState, transitions: { [SCREENS.IDLE]: { advance, }, [SCREENS.LOGIN_DETAILS]: { // ... }, }, }); };
No branches or pull requests
Would be awesome to have Typescript definitions.
The text was updated successfully, but these errors were encountered: