-
Notifications
You must be signed in to change notification settings - Fork 80
/
index.d.ts
58 lines (46 loc) · 1.53 KB
/
index.d.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
declare module 'reduxsauce' {
import { Action, AnyAction, Reducer, ActionCreator } from 'redux';
export interface Actions {
[action: string]: (string[] | ActionTypes | ActionCreator<ActionTypes>) | null;
}
export interface ActionTypes {
[action: string]: string | number | DefaultActionTypes | null;
}
export interface DefaultActionTypes {
[action: string]: string;
}
export interface DefaultActionCreators {
[action: string]: (...args: any[]) => AnyAction;
}
export interface Handlers<S> {
[type: string]: (state: S, action: any) => S;
}
/**
* Custom options for created types and actions
*
* prefix - prepend the string to all created types
*/
interface Options {
prefix: string;
}
export interface CreatedActions<T = DefaultActionTypes, C = DefaultActionCreators> {
Types: T;
Creators: C;
}
export function createActions<T = DefaultActionTypes, C = DefaultActionCreators>(
actions: Actions,
options?: Options
): CreatedActions<T, C>;
export function createReducer<S = {}, A extends Action = AnyAction>(
initialState: S,
handlers: Handlers<S>
): Reducer<S, A>;
export function createTypes<T = DefaultActionTypes>(types: string, options?: Options): T;
export function resettableReducer(
typeToReset: string
): <S, A extends Action = AnyAction>(originalReducer: Reducer<S, A>) => Reducer<S, A>;
export function resettableReducer<S, A extends Action = AnyAction>(
typeToReset: string,
originalReducer: Reducer<S, A>
): Reducer<S, A>;
}