Skip to content

Commit

Permalink
feat(overmind): return instance from send
Browse files Browse the repository at this point in the history
  • Loading branch information
christianalfoni committed Oct 9, 2020
1 parent b74acc9 commit 8da2c72
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/node_modules/overmind/src/statemachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface MachineMethods<States extends TState, Events extends TEvents> {
): Statemachine<States extends { current: T} ? States : never, Events> | undefined
send<T extends Events["type"]>(
...args: Events extends { type: T, data: any } ? [T, Events["data"]] : [T]
): Statemachine<States extends { current: T} ? States : never, Events> | undefined
): Statemachine<States extends { current: T} ? States : never, Events>
}

export type Statemachine<States extends TState, Events extends TEvents> = States & MachineMethods<States, Events>
Expand Down Expand Up @@ -63,7 +63,7 @@ export class StateMachine<State extends TState, Events extends TEvents> {
if (process.env.NODE_ENV === 'development') {
console.warn(`Overmind - The statemachine at "${this[PATH]}" has been disposed, but you tried to transition on it`)
}
return
return this
}

const transition = this[VALUE][TRANSITIONS][type]
Expand All @@ -74,7 +74,7 @@ export class StateMachine<State extends TState, Events extends TEvents> {
this.current = result
}

return
return this
}
matches(state: any) {
if (this.current === state) {
Expand Down

0 comments on commit 8da2c72

Please sign in to comment.