add Context generic type

This commit is contained in:
Brian Sakal
2023-05-11 23:26:38 -04:00
parent e37161d3a0
commit 0495f1d87a
2 changed files with 29 additions and 28 deletions
+3 -2
View File
@@ -1,12 +1,13 @@
import { Machine, State, On, Do, Goto, Spawn, Unspawn } from '../index';
const beginTimer = ()=>{};
const beginTimer = (ctx:C, e:E)=>{};
type S = 'green' | 'yellow' | 'red';
type E = ['entry',null] | ['timer-finished',null];
type C = null;
const machine =
Machine<S,E>(
Machine<S,E,C>(
State('green',
On('entry',
Do(beginTimer)