Skip to content

Commit acf2b5d

Browse files
robertpbaxterLevelbossMike
authored andcommitted
add types for new update method
1 parent d0ab722 commit acf2b5d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

index.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ import {
88
// NOTE: there is a lot of repetition here :(
99
// Repetition will be less when ember-statecharts _is_ TS?
1010

11+
export type UpdateFnArg = {
12+
machine: StateMachine<Context, Schema, Events>;
13+
context: Context;
14+
config: MachineConfig<Context, Schema, Events>;
15+
send: Send<Context, Schema, Events>;
16+
restart: () => void;
17+
};
18+
export type UpdateFn = (arg: UpdateFnArg) => void;
1119

1220
// Private Types
1321
// For building the Public Types?
@@ -24,6 +32,7 @@ type InterpretedUsable<Context, Schema, Events extends EventObject> = {
2432
service: Interpreter<Context, Schema, Events>;
2533
withConfig: (...args: WithConfigParams<Context, Schema, Events>) => InterpretedUsable<Context, Schema, Events>;
2634
withContext: (...args: WithContextParams<Context, Schema, Events>) => InterpretedUsable<Context, Schema, Events>;
35+
update: (fn: UpdateFn) => InterpretedUsable<Context, Schema, Events>;
2736
}
2837

2938
type UsableStatechart<Context, Schema, Events extends EventObject> =

0 commit comments

Comments
 (0)