Add redux-batched-actions typings. (#13054)

This commit is contained in:
Chad Burggraf
2016-12-20 23:17:24 +09:00
committed by Masahiro Wakame
parent 82c28ae865
commit 20c296cac7
5 changed files with 64 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
// Type definitions for redux-batched-actions 0.1
// Project: https://github.com/tshelburne/redux-batched-actions
// Definitions by: Chad Burggraf <https://github.com/ChadBurggraf>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = ReduxBatchedActions;
export as namespace ReduxBatchedActions;
import { Action, Reducer } from 'redux';
declare namespace ReduxBatchedActions {
/**
* Batching action creator that creates a higher-order
* action from an array of actions.
*/
export function batchActions<A extends Action>(actions: A[]): Action;
/**
* Creates a higher-order reducer that enables batching
* actions for the given reducer.
*/
export function enableBatching<S>(reducer: Reducer<S>): Reducer<S>;
}
+5
View File
@@ -0,0 +1,5 @@
{
"dependencies": {
"redux": "^3.6.0"
}
}
@@ -0,0 +1,14 @@
import { Reducer, createStore } from 'redux';
import { Action, createAction } from 'redux-actions';
import { enableBatching, batchActions } from 'redux-batched-actions';
const doThing = createAction('DO_THING');
const doOther = createAction('DO_OTHER');
const reducer = (state: any = {}, action: Action<any>): any => {
return state;
};
const store = createStore(enableBatching(reducer), {});
store.dispatch(batchActions([doThing(), doOther()]));
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"redux-batched-actions-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "../tslint.json"
}