mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
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
This commit is contained in:
parent
bf37dfddd2
commit
317dfc327a
7
types/react-redux-epic/client.d.ts
vendored
Normal file
7
types/react-redux-epic/client.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
export function render(
|
||||
element: React.ReactElement<any>,
|
||||
container: Element
|
||||
): Observable<undefined>;
|
||||
22
types/react-redux-epic/index.d.ts
vendored
Normal file
22
types/react-redux-epic/index.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
// Type definitions for react-redux-epic 1.1
|
||||
// Project: https://github.com/BerkeleyTrue/react-redux-epic#readme
|
||||
// Definitions by: forabi <https://github.com/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<T, S, D, O extends T>(
|
||||
epic: Epic<T, S, D, O>
|
||||
): Epic<T, S, D, O>;
|
||||
|
||||
export function renderToString(
|
||||
element: React.ReactElement<any>,
|
||||
wrappedEpic: Epic<any, any>
|
||||
): Observable<{ markup: string }>;
|
||||
7
types/react-redux-epic/package.json
Normal file
7
types/react-redux-epic/package.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"rxjs": "^5.5.5",
|
||||
"redux-observable": "^0.18.0"
|
||||
}
|
||||
}
|
||||
26
types/react-redux-epic/react-redux-epic-tests.tsx
Normal file
26
types/react-redux-epic/react-redux-epic-tests.tsx
Normal file
@ -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, {}> = action$ => {
|
||||
return action$
|
||||
.do(action => {
|
||||
// Action dispatched
|
||||
})
|
||||
.ignoreElements();
|
||||
};
|
||||
|
||||
const wrappedRootEpic = wrapRootEpic(rootEpic);
|
||||
|
||||
renderToString(<div>Hello, world</div>, wrappedRootEpic).subscribe({
|
||||
next({ markup }) {
|
||||
// Done
|
||||
}
|
||||
});
|
||||
17
types/react-redux-epic/tsconfig.json
Normal file
17
types/react-redux-epic/tsconfig.json
Normal file
@ -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"]
|
||||
}
|
||||
3
types/react-redux-epic/tslint.json
Normal file
3
types/react-redux-epic/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user