DefinitelyTyped/types/react-redux-epic/react-redux-epic-tests.tsx
Muhammad Fawwaz Orabi 317dfc327a Add type definitions for react-redux-epic (#23823)
* Add type definitions for react-redux-epic

* Require TS 2.6

* Add package.json

* Trigger CI

* Address feedback

* Add tests

* Remove unnecessary type paramerters

* Fix lint issues

* Re-add generics
2018-02-26 11:41:38 -08:00

27 lines
604 B
TypeScript

import * as React from 'react';
import { Epic } from 'redux-observable';
import { renderToString, wrapRootEpic } from 'react-redux-epic';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/ignoreElements';
interface Action {
type: string;
payload: any;
}
const rootEpic: Epic<Action, {}> = action$ => {
return action$
.do(action => {
// Action dispatched
})
.ignoreElements();
};
const wrappedRootEpic = wrapRootEpic(rootEpic);
renderToString(<div>Hello, world</div>, wrappedRootEpic).subscribe({
next({ markup }) {
// Done
}
});