forked from joshburgess/redux-most
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
84 lines (68 loc) · 2.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
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import {
Action,
Middleware,
MiddlewareAPI,
StoreEnhancer,
} from 'redux';
import { Stream } from 'most';
/*****************************************
Type abbreviations:
A = Action
T = ActionType (a string or symbol)
S = State
*****************************************/
// for the original, redux-observable style API
export declare interface Epic<A extends Action, S> {
(
actionStream: Stream<A>,
middlewareApi: MiddlewareAPI<S>
): Stream<A>;
}
// for the newer, declarative only API, which takes in a state stream
// to sample via the withState utility instead of exposing dispatch/getState
export declare interface Epic<A extends Action, S> {
(
actionStream: Stream<A>,
stateStream: Stream<S>
): Stream<A>;
}
export interface EpicMiddleware<A extends Action, S> extends Middleware {
replaceEpic (
nextEpic: Epic<A, S>
): void;
}
export declare function createEpicMiddleware<A extends Action, S> (
rootEpic: Epic<A, S>
): EpicMiddleware<A, S>;
export declare function createStateStreamEnhancer<A extends Action, S> (
epicMiddleware: EpicMiddleware<A, S>
): StoreEnhancer<S>;
export declare function combineEpics<A extends Action, S> (
epicsArray: Epic<A, S>[]
): Epic<A, S>;
export declare type ActionType = string | symbol
// overloads exist due to select being a curried function
export declare function select<A extends Action, T = ActionType> (
actionType: T,
stream: Stream<A>
): Stream<A>;
export declare function select<A extends Action, T = ActionType> (
actionType: T
): (stream: Stream<A>) => Stream<A>;
// overloads exist due to selectArray being a curried function
export declare function selectArray<A extends Action, T = ActionType> (
actionTypes: T[],
stream: Stream<A>
): Stream<A>;
export declare function selectArray<A extends Action, T = ActionType> (
actionTypes: T[]
): (stream: Stream<A>) => Stream<A>;
// overloads exist due to withState being a curried function
export declare function withState<A extends Action, S> (
stateStream: Stream<S>,
actionStream: Stream<A>
): Stream<[S, A]>;
export declare function withState<A extends Action, S> (
stateStream: Stream<S>
): (actionStream: Stream<A>) => Stream<[S, A]>;
export const EPIC_END = '@@redux-most/EPIC_END';