diff --git a/types/react-redux-epic/client.d.ts b/types/react-redux-epic/client.d.ts new file mode 100644 index 0000000000..54535f59ec --- /dev/null +++ b/types/react-redux-epic/client.d.ts @@ -0,0 +1,7 @@ +import * as React from 'react'; +import { Observable } from 'rxjs/Observable'; + +export function render( + element: React.ReactElement, + container: Element +): Observable; diff --git a/types/react-redux-epic/index.d.ts b/types/react-redux-epic/index.d.ts new file mode 100644 index 0000000000..f9bba811f8 --- /dev/null +++ b/types/react-redux-epic/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for react-redux-epic 1.1 +// Project: https://github.com/BerkeleyTrue/react-redux-epic#readme +// Definitions by: forabi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from 'react'; +import { Observable } from 'rxjs/Observable'; +import { Epic } from 'redux-observable'; + +export interface Action { + type: string; +} + +export function wrapRootEpic( + epic: Epic +): Epic; + +export function renderToString( + element: React.ReactElement, + wrappedEpic: Epic +): Observable<{ markup: string }>; diff --git a/types/react-redux-epic/package.json b/types/react-redux-epic/package.json new file mode 100644 index 0000000000..807e511de4 --- /dev/null +++ b/types/react-redux-epic/package.json @@ -0,0 +1,7 @@ +{ + "private": true, + "dependencies": { + "rxjs": "^5.5.5", + "redux-observable": "^0.18.0" + } +} diff --git a/types/react-redux-epic/react-redux-epic-tests.tsx b/types/react-redux-epic/react-redux-epic-tests.tsx new file mode 100644 index 0000000000..fa1d4f9c77 --- /dev/null +++ b/types/react-redux-epic/react-redux-epic-tests.tsx @@ -0,0 +1,26 @@ +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$ => { + return action$ + .do(action => { + // Action dispatched + }) + .ignoreElements(); +}; + +const wrappedRootEpic = wrapRootEpic(rootEpic); + +renderToString(
Hello, world
, wrappedRootEpic).subscribe({ + next({ markup }) { + // Done + } +}); diff --git a/types/react-redux-epic/tsconfig.json b/types/react-redux-epic/tsconfig.json new file mode 100644 index 0000000000..64657de53c --- /dev/null +++ b/types/react-redux-epic/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "jsx": "React", + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "client.d.ts", "react-redux-epic-tests.tsx"] +} diff --git a/types/react-redux-epic/tslint.json b/types/react-redux-epic/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/react-redux-epic/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}