Skip to content

Commit

Permalink
feat(overmind): adjust to using right hand typing of actions
Browse files Browse the repository at this point in the history
  • Loading branch information
christianalfoni committed Oct 22, 2020
1 parent 3ba4638 commit 38baf14
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/node_modules/overmind/src/config/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('Config', () => {

return Promise.all([
app.actions.lazy.loadConfig('configA'),
app.actions.loadConfigB({}),
app.actions.loadConfigB(),
]).then(() => {
// @ts-ignore
expect(app.state.configA.foo).toEqual('bar')
Expand Down
4 changes: 2 additions & 2 deletions packages/node_modules/overmind/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ describe('Overmind', () => {
type: 'action',
})
})
app.actions.doThis({})
app.actions.doThis()
})
test('should track operator start and end', () => {
expect.assertions(2)
Expand Down Expand Up @@ -227,7 +227,7 @@ describe('Overmind', () => {
type: 'action',
})
})
app.actions.doThis({})
app.actions.doThis()
})
test('should track mutations', () => {
expect.assertions(1)
Expand Down
10 changes: 5 additions & 5 deletions packages/node_modules/overmind/src/internalTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ITrackStateTree,
} from 'proxy-state-tree'

import { IAction, IOperator } from './types'
import { IAction, IOperator, IContext } from './types'

export type SubType<Base, Condition> = Pick<
Base,
Expand Down Expand Up @@ -173,11 +173,11 @@ export type ResolveActions<
? {}
: {
[T in keyof Actions]: Actions[T] extends IOperator<any, any, any>
? TActionValue<Actions[T]> extends void
? Actions[T] extends (context: IContext<any>, value: void) => any
? () => Promise<void>
: (value: TActionValue<Actions[T]>) => Promise<void>
: Actions[T] extends IAction<any, any, any>
? TActionValue<Actions[T]> extends void
? Actions[T] extends (context: IContext<any>, value: void) => any
? () => ReturnType<Actions[T]>
: (value: TActionValue<Actions[T]>) => ReturnType<Actions[T]>
: Actions[T] extends NestedActions
Expand All @@ -202,11 +202,11 @@ export type ResolveMockActions<
? {}
: {
[T in keyof Actions]: Actions[T] extends IOperator<any, any, any>
? TActionValue<Actions[T]> extends void
? Actions[T] extends (context: IContext<any>, value: void) => any
? () => Promise<MockResult>
: (value: TActionValue<Actions[T]>) => Promise<MockResult>
: Actions[T] extends IAction<any, any, any>
? TActionValue<Actions[T]> extends void
? Actions[T] extends (context: IContext<any>, value: void) => any
? () => Promise<MockResult>
: (value: TActionValue<Actions[T]>) => Promise<MockResult>
: Actions[T] extends NestedMockActions
Expand Down

0 comments on commit 38baf14

Please sign in to comment.