11import 'proxy-state-tree'
2- import { unstable_scheduleCallback , unstable_getCurrentPriorityLevel , unstable_cancelCallback } from 'scheduler'
2+
33import {
4+ Config as DefaultConfig ,
45 EventType ,
56 IConfiguration ,
67 MODE_SSR ,
78 Overmind ,
8- OvermindMock ,
9+ OvermindMock
910} from 'overmind'
1011import { IMutationCallback } from 'proxy-state-tree'
1112import * as react from 'react'
13+ import { unstable_cancelCallback , unstable_getCurrentPriorityLevel , unstable_scheduleCallback } from 'scheduler'
1214
1315const IS_PRODUCTION = process . env . NODE_ENV === 'production'
1416const IS_TEST = process . env . NODE_ENV === 'test'
@@ -46,7 +48,7 @@ function getDisplayName(component): string {
4648 ) ;
4749}
4850
49- export interface IConnect < Config extends IConfiguration > {
51+ export interface IConnect < Config extends IConfiguration = DefaultConfig > {
5052 overmind : {
5153 state : Overmind < Config > [ 'state' ]
5254 actions : Overmind < Config > [ 'actions' ]
@@ -245,23 +247,23 @@ const useReaction = <Config extends IConfiguration>(): Overmind<Config>['reacti
245247 return overmind . reaction
246248}
247249
248- export const createStateHook : < Config extends IConfiguration > ( ) => ( ) => Overmind < Config > [ 'state' ] = ( ) => {
250+ export const createStateHook : < Config extends IConfiguration = DefaultConfig > ( ) => ( ) => Overmind < Config > [ 'state' ] = ( ) => {
249251 return useState as any
250252}
251253
252- export const createActionsHook : < Config extends IConfiguration > ( ) => ( ) => Overmind < Config > [ 'actions' ] = ( ) => {
254+ export const createActionsHook : < Config extends IConfiguration = DefaultConfig > ( ) => ( ) => Overmind < Config > [ 'actions' ] = ( ) => {
253255 return useActions as any
254256}
255257
256- export const createEffectsHook : < Config extends IConfiguration > ( ) => ( ) => Overmind < Config > [ 'effects' ] = ( ) => {
258+ export const createEffectsHook : < Config extends IConfiguration = DefaultConfig > ( ) => ( ) => Overmind < Config > [ 'effects' ] = ( ) => {
257259 return useEffects as any
258260}
259261
260- export const createReactionHook : < Config extends IConfiguration > ( ) => ( ) => Overmind < Config > [ 'reaction' ] = ( ) => {
262+ export const createReactionHook : < Config extends IConfiguration = DefaultConfig > ( ) => ( ) => Overmind < Config > [ 'reaction' ] = ( ) => {
261263 return useReaction as any
262264}
263265
264- export const createHook : < Config extends IConfiguration > ( ) => ( ) => {
266+ export const createHook : < Config extends IConfiguration = DefaultConfig > ( ) => ( ) => {
265267 state : Overmind < Config > [ 'state' ]
266268 actions : Overmind < Config > [ 'actions' ]
267269 effects : Overmind < Config > [ 'effects' ]
@@ -284,15 +286,22 @@ export const createHook: <Config extends IConfiguration>() => () => {
284286 }
285287}
286288
287- export const createConnect : < ThisConfig extends IConfiguration > ( ) =>
288- < Props , TComponent extends IReactComponent < Props & {
289- overmind : {
290- state : Overmind < ThisConfig > [ 'state' ]
291- actions : Overmind < ThisConfig > [ 'actions' ]
292- reaction : Overmind < ThisConfig > [ 'reaction' ]
289+ export const createConnect : <
290+ ThisConfig extends IConfiguration = DefaultConfig
291+ > ( ) => <
292+ Props ,
293+ TComponent extends IReactComponent <
294+ Props & {
295+ overmind : {
296+ state : Overmind < ThisConfig > [ 'state' ]
297+ actions : Overmind < ThisConfig > [ 'actions' ]
298+ reaction : Overmind < ThisConfig > [ 'reaction' ]
299+ }
293300 }
294- }
295- > > ( component : TComponent ) => IReactComponent <
301+ >
302+ > (
303+ component : TComponent
304+ ) => IReactComponent <
296305 Omit <
297306 react . ComponentPropsWithRef < TComponent > & IConnect < Overmind < ThisConfig > > ,
298307 keyof IConnect < Overmind < ThisConfig > >
0 commit comments