begin typescript types

This commit is contained in:
Brian Sakal
2023-05-08 00:38:16 -04:00
parent feeb933e90
commit f6adaa8f53
3 changed files with 63 additions and 1 deletions
+34
View File
@@ -0,0 +1,34 @@
import { Machine, State, On, Do, Goto, Spawn, Unspawn } from '../index';
const beginTimer = ()=>{};
type S = 'green' | 'yellow' | 'red';
type E = 'entry' | 'timer-finished';
const machine =
Machine(
State('green',
On('entry',
Do(beginTimer)
),
On('timer-finished',
Goto('yellow')
)
),
State('yellow',
On('entry',
Do(beginTimer)
),
On('timer-finished',
Goto('red')
)
),
State('red',
On('entry',
Do(beginTimer)
),
On('timer-finished',
Goto('green')
)
),
);