File tree Expand file tree Collapse file tree 2 files changed +19
-8
lines changed
Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -274,20 +274,30 @@ export function createStateHook<Config extends IConfiguration>(): StateHook<Conf
274274 } ) as any
275275}
276276
277- export function createActionsHook < Config extends IConfiguration > ( ) {
278- return ( ) : Overmind < Config > [ "actions" ] => {
277+ export interface ActionsHook < Config extends IConfiguration > {
278+ ( ) : Ref < Overmind < Config > [ "actions" ] > ;
279+ < CB extends ( actions : Overmind < Config > [ "actions" ] ) => object > ( cb : CB ) : CB extends ( actions : Overmind < Config > [ "actions" ] ) => infer O ? O extends object ? Ref < O > : never : never ;
280+ }
281+
282+ export function createActionsHook < Config extends IConfiguration > ( ) : ActionsHook < Config > {
283+ return ( ( cb ?: any ) : Overmind < Config > [ "actions" ] => {
279284 const overmindInstance = inject < any > ( 'overmind' )
280285
281- return overmindInstance . actions
282- }
286+ return cb ? cb ( overmindInstance . actions ) : overmindInstance . actions
287+ } ) as any
283288}
284289
285- export function createEffectsHook < Config extends IConfiguration > ( ) {
286- return ( ) : Overmind < Config > [ "effects" ] => {
290+ export interface EffectsHook < Config extends IConfiguration > {
291+ ( ) : Ref < Overmind < Config > [ "effects" ] > ;
292+ < CB extends ( effects : Overmind < Config > [ "effects" ] ) => object > ( cb : CB ) : CB extends ( effects : Overmind < Config > [ "effects" ] ) => infer O ? O extends object ? Ref < O > : never : never ;
293+ }
294+
295+ export function createEffectsHook < Config extends IConfiguration > ( ) : EffectsHook < Config > {
296+ return ( ( cb ?: any ) : Overmind < Config > [ "effects" ] => {
287297 const overmindInstance = inject < any > ( 'overmind' )
288298
289- return overmindInstance . effects
290- }
299+ return cb ? cb ( overmindInstance . effects ) : overmindInstance . effects
300+ } ) as any
291301}
292302
293303export function createReactionHook < Config extends IConfiguration > ( ) {
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ export type NestedPartial<T> = T extends Function
2020export type Options = {
2121 delimiter ?: string
2222 name ?: string
23+ devEnv ?: string
2324 devtools ?: string | boolean
2425 logProxies ?: boolean
2526 hotReloading ?: boolean
You can’t perform that action at this time.
0 commit comments