11declare module 'react-hookstore' {
22 type StateCallback < TState > = ( state : TState ) => void ;
33
4- type ReducerType < TState , TPayload = any > = ( state : TState , payload : TPayload ) => TState ;
4+ type ReducerType < TState , TData = any > = ( state : TState , data : TData ) => TState ;
55
66 type SetStateType < TState > = ( state : TState , callback ?: StateCallback < TState > ) => void ;
77
8- type DispatchType < TState , TPayload = any > = ( payload : TPayload , callback ?: StateCallback < TState > ) => void ;
8+ type DispatchType < TState , TData = any > = ( data : TData , callback ?: StateCallback < TState > ) => void ;
99
1010 type StoreStateHookType < TState > = [ TState , SetStateType < TState > ] ;
1111
12- type StoreDispatchHookType < TState , TPayload = any > = [ TState , DispatchType < TState , TPayload > ] ;
12+ type StoreDispatchHookType < TState , TData = any > = [ TState , DispatchType < TState , TData > ] ;
1313
1414 const defaultReducer : ReducerType < any > ;
1515
16- export interface StoreSpec < TState , TPayload = any > {
16+ export interface StoreSpec < TState , TData = any > {
1717 state : TState ;
18- reducer : ReducerType < TState , TPayload > ;
19- setState : SetStateType < TState > | DispatchType < TState , TPayload > ;
18+ reducer : ReducerType < TState , TData > ;
19+ setState : SetStateType < TState > | DispatchType < TState , TData > ;
2020 setters : StateCallback < TState > [ ]
2121 }
2222
@@ -26,27 +26,27 @@ declare module 'react-hookstore' {
2626 setState ( state : TState , callback ?: StateCallback < TState > ) : void ;
2727 }
2828
29- export interface ReducerStoreInterface < TState , TPayload = any > {
29+ export interface ReducerStoreInterface < TState , TData = any > {
3030 readonly name : string ;
3131 getState ( ) : TState ;
32- dispatch < TPayload > ( payload : TPayload , callback ?: StateCallback < TState > ) : void ;
32+ dispatch < TData > ( data : TData , callback ?: StateCallback < TState > ) : void ;
3333 }
3434
35- export function createStore < TState , TPayload = any > ( name : string , state : TState , reducer : ReducerType < TState , TPayload > ) : ReducerStoreInterface < TState , TPayload > ;
35+ export function createStore < TState , TData = any > ( name : string , state : TState , reducer : ReducerType < TState , TData > ) : ReducerStoreInterface < TState , TData > ;
3636
3737 export function createStore < TState > ( name : string , state : TState ) : StateStoreInterface < TState > ;
3838
3939 export function createStore < TState > ( name : string , state : TState , reducer : ReducerType < TState > ) : ReducerStoreInterface < TState > ;
4040
41- export function getStoreByName < TState , TPayload = any > ( name : string ) : StateStoreInterface < TState > | ReducerStoreInterface < TState > ;
41+ export function getStoreByName < TState , TData = any > ( name : string ) : StateStoreInterface < TState > | ReducerStoreInterface < TState > ;
4242
4343 export function getStoreByName < TState > ( name : string ) : StateStoreInterface < TState > | ReducerStoreInterface < TState > ;
4444
4545 export function useStore < TState > ( identifier : string ) : StoreStateHookType < TState > | StoreDispatchHookType < TState > ;
4646
47- export function useStore < TState , TPayload = any > ( identifier : string ) : StoreDispatchHookType < TState , TPayload > ;
47+ export function useStore < TState , TData = any > ( identifier : string ) : StoreDispatchHookType < TState , TData > ;
4848
4949 export function useStore < TState > ( store : StateStoreInterface < TState > ) : StoreStateHookType < TState > ;
5050
51- export function useStore < TState , TPayload = any > ( store : ReducerStoreInterface < TState , TPayload > ) : StoreDispatchHookType < TState , TPayload > ;
51+ export function useStore < TState , TData = any > ( store : ReducerStoreInterface < TState , TData > ) : StoreDispatchHookType < TState , TData > ;
5252}
0 commit comments