Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
devanshj committed Aug 24, 2020
1 parent 73a077f commit 79df495
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
type TODO = any;

declare const machine:
<D extends MachineDefinition.Of<D>>(definition: D) => MachineHandle.Of<D> & Tag<"Machine">;

Expand All @@ -12,17 +10,17 @@ namespace MachineDefinition {
, states: { [state in string]: State<keyof Prop<D, "states">, unknown, unknown, unknown> }
};

type State<T, Ci, E, Co> =
| (
& StateBase<T, Ci, E, Co>
& { initial?: never
, states?: never
}
)
| (
& StateBase<T, Ci, E, Co>
& Tag<"ChildMachine">
);
type State<T, Ci, E, Co> =
| (
& StateBase<T, Ci, E, Co>
& { initial?: never
, states?: never
}
)
| (
& StateBase<T, Ci, E, Co>
& Tag<"ChildMachine">
);

type StateBase<T, Ci, E, Co> =
{ on?:
Expand All @@ -40,7 +38,7 @@ namespace MachineHandle {
transition: (event: Event<D>) => State<D>
}

export type Event<D> = {
type Event<D> = {
[S in StateIdentifier<D>]: {
[E in keyof Transitions<D, S>]:
HasTransition<D, S> extends true
Expand All @@ -56,7 +54,7 @@ namespace MachineHandle {
? P
: never;

export type State<D> =
type State<D> =
| {
[S in StateIdentifier<D>]:
{ [E in keyof Transitions<D, S>]:
Expand Down

0 comments on commit 79df495

Please sign in to comment.