-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
41 lines (34 loc) · 1.22 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
export const STOP_PROPAGATION: string;
export const createActionListener: () => {
actionListener: () => void;
setStore: (store: object) => void;
};
export type ListenerListItem = string | (() => void);
export function useActionListeners(...args: ListenerListItem[]): void;
export interface TransitionStates {
[key: string]: ListenerListItem | ListenerListItem[];
}
export type TransitionReducer<T> = (transition: string, action: object) => T;
export function useTransitions<T>(
transitionStates: TransitionStates,
transitionReducer: TransitionReducer<T>
): T;
export function mockTransition<T>(
transitionStates: TransitionStates,
transitionReducer: TransitionReducer<T>
): (action: ListenerListItem) => T;
export function usePendingState(
pending: ListenerListItem | ListenerListItem[],
success: ListenerListItem | ListenerListItem[],
failure: ListenerListItem | ListenerListItem[],
failureHandler: (error: object) => any
): [boolean, any];
export type Thunk = () => void;
export interface ThunkApi {
withTransitionStates: (states: object | ((a: Thunk) => void)) => Thunk;
}
export function thunk(thunkFn: () => void): ThunkApi;
export function useThunkReducer<T>(
thunk: Thunk,
reducer: TransitionReducer<T>
): T;