-
Notifications
You must be signed in to change notification settings - Fork 31
/
redux-undo.d.ts
68 lines (50 loc) · 2.09 KB
/
redux-undo.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
59
60
61
62
63
64
65
66
67
68
import { Reducer, Action } from 'redux';
module 'redux-undo' {
export interface StateWithHistory<State> {
past: State[];
present: State;
future: State[];
}
export type FilterFunction = (action: Action) => boolean;
export type combineFilters = (...filters: FilterFunction[]) => FilterFunction;
interface Options {
/* Set a limit for the history */
limit?: number;
/** If you don't want to include every action in the undo/redo history, you can add a filter function to undoable */
filter?: FilterFunction;
/** Define a custom action type for this undo action */
undoType?: string;
/** Define a custom action type for this redo action */
redoType?: string;
/** Define custom action type for this jump action */
jumpType?: string;
/** Define custom action type for this jumpToPast action */
jumpToPastType?: string;
/** Define custom action type for this jumpToFuture action */
jumpToFutureType?: string;
/** [beta only] Define custom action type for this clearHistory action */
clearHistoryType?: string;
/** History will be (re)set upon init action type */
initTypes?: string[];
/** Set to `true` to turn on debugging */
debug?: boolean;
}
interface Undoable {
<State>(reducer: Reducer<State>, options?: Options): Reducer<StateWithHistory<State>>;
}
type includeAction = (actions: string | string[]) => FilterFunction;
type excludeAction = typeof includeAction;
const undoable: Undoable;
export default undoable;
/**
* If you don't want to include every action in the undo/redo history, you can add a filter function to undoable.
* redux-undo provides you with the includeAction and excludeAction helpers for basic filtering.
*/
export const includeAction: includeAction;
/**
* If you don't want to include every action in the undo/redo history, you can add a filter function to undoable.
* redux-undo provides you with the includeAction and excludeAction helpers for basic filtering.
*/
export const excludeAction: excludeAction;
export const combineFilters: combineFilters;
}