UNPKG

1.77 kBTypeScriptView Raw
1import { Observable, OperatorFunction } from 'rxjs';
2import { Middleware, Action } from 'redux';
3
4declare class StateObservable<S> extends Observable<S> {
5 value: S;
6 private __notifier;
7 constructor(input$: Observable<S>, initialState: S);
8}
9
10declare interface Epic<Input = unknown, Output extends Input = Input, State = void, Dependencies = any> {
11 (action$: Observable<Input>, state$: StateObservable<State>, dependencies: Dependencies): Observable<Output>;
12}
13
14/**
15 Merges all epics into a single one.
16 */
17declare function combineEpics<Input = unknown, Output extends Input = Input, State = void, Dependencies = any>(...epics: Epic<Input, Output, State, Dependencies>[]): Epic<Input, Output, State, Dependencies>;
18
19interface Options<D = any> {
20 dependencies?: D;
21}
22interface EpicMiddleware<Input = unknown, Output extends Input = Input, State = void, Dependencies = any> extends Middleware<{}, State> {
23 run(rootEpic: Epic<Input, Output, State, Dependencies>): void;
24}
25declare function createEpicMiddleware<Input = unknown, Output extends Input = Input, State = void, Dependencies = any>(options?: Options<Dependencies>): EpicMiddleware<Input, Output, State, Dependencies>;
26
27/**
28 * Inferring the types of this is a bit challenging, and only works in newer
29 * versions of TypeScript.
30 *
31 * @param ...types One or more Redux action types you want to filter for, variadic.
32 */
33declare function ofType<Input, Type extends string, Output extends Input = Extract<Input, Action<Type>>>(...types: [Type, ...Type[]]): OperatorFunction<Input, Output>;
34
35declare const resetDeprecationsSeen: () => void;
36
37export { Epic, EpicMiddleware, StateObservable, resetDeprecationsSeen as __FOR_TESTING__resetDeprecationsSeen, combineEpics, createEpicMiddleware, ofType };