import { Machine, State, On, Do, Goto, Spawn, Unspawn } from '../index'; const beginTimer = (ctx:C, e:E)=>{}; type S = 'green' | 'yellow' | 'red'; type E = ['entry',null] | ['timer-finished',null]; type C = null; 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') ) ), );