Permalink
Browse files

fix(typings): Add dependencies to middleware options. (#207)

  • Loading branch information...
sebald authored and jayphelps committed Mar 3, 2017
1 parent 331440c commit fb911a83557f85e53371ebf766656da775e2b8de
Showing with 7 additions and 1 deletion.
  1. +2 −1 index.d.ts
  2. +5 −0 test/typings.ts
@@ -9,7 +9,7 @@ export declare class ActionsObservable<T> extends Observable<T> {
* because we would need non-final position spread params e.g.
* `static of<T>(...items: T, scheduler?: Scheduler): ActionsObservable<T>`
* which isn't possible in either JavaScript or TypeScript. So instead, we
* provide safe typing for up to 6 items, following by a scheduler.
* provide safe typing for up to 6 items, following by a scheduler.
*/
static of<T>(item1: T, scheduler?: Scheduler): ActionsObservable<T>;
static of<T>(item1: T, item2: T, scheduler?: Scheduler): ActionsObservable<T>;
@@ -42,6 +42,7 @@ interface Adapter {
interface Options {
adapter?: Adapter;
dependencies: { [key:string]: any }
}
export declare function createEpicMiddleware<T, S>(rootEpic: Epic<T, S>, options?: Options): EpicMiddleware<T, S>;
@@ -1,6 +1,7 @@
import { expect } from 'chai';
import { createStore, applyMiddleware, MiddlewareAPI } from 'redux';
import { Observable } from 'rxjs/Observable';
import { ajax } from 'rxjs/observable/dom/ajax';
import { asap } from 'rxjs/scheduler/asap';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/mapTo';
@@ -78,6 +79,10 @@ const customEpic2 = (action$, store, some) =>
payload
}));
const customEpicMiddleware: EpicMiddleware<FluxStandardAction, any> = createEpicMiddleware<FluxStandardAction, any>(rootEpic1, {
dependencies: { getJSON: ajax.getJSON }
});
const combinedCustomEpics = combineEpics<CustomEpic<FluxStandardAction, any, any>>(customEpic, customEpic2);
const reducer = (state = [], action) => state.concat(action);

0 comments on commit fb911a8

Please sign in to comment.