UNPKG

@sigi/react

Version:

React bindings for sigi framework

16 lines (15 loc) 1.43 kB
import { EffectModule, ActionOfEffectModule } from '@sigi/core'; import { ConstructorOf } from '@sigi/types'; export type StateSelector<S, U> = { (state: S): U; }; export type StateSelectorConfig<S, U> = { selector: StateSelector<S, U>; }; export declare function useDispatchers<M extends EffectModule<S>, S = any>(_A: ConstructorOf<M>): ActionOfEffectModule<M, S>; export declare function useModuleState<M extends EffectModule<any>>(A: ConstructorOf<M>): M extends EffectModule<infer State> ? State : never; export declare function useModuleState<M extends EffectModule<any>, U>(A: ConstructorOf<M>, config: M extends EffectModule<infer State> ? StateSelectorConfig<State, U> : never): M extends EffectModule<infer State> ? (typeof config)['selector'] extends StateSelector<State, infer NewState> ? NewState : never : never; export declare function useModule<M extends EffectModule<any>>(A: ConstructorOf<M>): M extends EffectModule<infer State> ? [State, ActionOfEffectModule<M, State>] : never; export declare function useModule<M extends EffectModule<any>, U>(A: ConstructorOf<M>, config: M extends EffectModule<infer State> ? StateSelectorConfig<State, U> : never): M extends EffectModule<infer State> ? (typeof config)['selector'] extends StateSelector<State, infer NewState> ? [NewState, ActionOfEffectModule<M, State>] : never : never; export { SSRContext } from './ssr-context'; export * from './injectable-context';