-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.ts
38 lines (33 loc) · 1.05 KB
/
models.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { Task } from 'redux-saga';
import { APP_CONST, APP_EVENTS } from './constants';
import { Reducer, Store } from 'redux';
export interface APP_ACTION {
type: APP_CONST,
repos: boolean,
username: boolean,
error: boolean,
}
/**
* Action creator tags
* @param T type - Name of the actions
* @param U payLoad - that holds changed state of your component
* @param meta Metadata like listeners, callbacks or any extra info
* @returns Action created with all parameters
*/
export type ValueOf<T> = T[keyof T];
export type ActionTags<T, U> = {
type: ValueOf<T>;
payLoad: { [key: string]: any } | U ;
meta?: { [key: string]: any } | undefined;
};
export interface SagaDescribe {
mode?: APP_EVENTS,
saga: () => void,
task: Task
}
export interface StoreParameters extends Store {
replaceReducer: (param: Reducer) => void,
runSaga: (saga: () => void, arg: any) => void,
injectedReducers: { [key: string]: (state: any, actions: any) => any },
injectedSagas: { [key: string]: SagaDescribe | any },
}