mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Add redux-batched-actions typings. (#13054)
This commit is contained in:
committed by
Masahiro Wakame
parent
82c28ae865
commit
20c296cac7
Vendored
+23
@@ -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>;
|
||||
}
|
||||
@@ -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()]));
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
}
|
||||
Reference in New Issue
Block a user