mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[@wordpress/redux-routine] add new definitions (#36688)
This commit is contained in:
parent
5710db716f
commit
d2bf4fe0fa
20
types/wordpress__redux-routine/index.d.ts
vendored
Normal file
20
types/wordpress__redux-routine/index.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
// Type definitions for @wordpress/redux-routine 3.4
|
||||
// Project: https://github.com/WordPress/gutenberg/tree/master/packages/redux-routine/README.md
|
||||
// Definitions by: Derek Sifford <https://github.com/dsifford>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.5
|
||||
|
||||
import { AnyAction, Middleware } from 'redux';
|
||||
|
||||
/**
|
||||
* Creates a Redux middleware, given an object of controls where each key is an action type for
|
||||
* which to act upon, the value a function which returns either a promise which is to resolve when
|
||||
* evaluation of the action should continue, or a value. The value or resolved promise value is
|
||||
* assigned on the return value of the yield assignment. If the control handler returns undefined,
|
||||
* the execution is not continued.
|
||||
*
|
||||
* @param controls - Object of control handlers.
|
||||
*/
|
||||
declare function createMiddleware(controls?: Record<string, (action: AnyAction) => any>): Middleware;
|
||||
|
||||
export default createMiddleware;
|
||||
6
types/wordpress__redux-routine/package.json
Normal file
6
types/wordpress__redux-routine/package.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"redux": "^4.0.1"
|
||||
}
|
||||
}
|
||||
19
types/wordpress__redux-routine/tsconfig.json
Normal file
19
types/wordpress__redux-routine/tsconfig.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"@wordpress/redux-routine": ["wordpress__redux-routine"]
|
||||
}
|
||||
},
|
||||
"files": ["index.d.ts", "wordpress__redux-routine-tests.ts"]
|
||||
}
|
||||
1
types/wordpress__redux-routine/tslint.json
Normal file
1
types/wordpress__redux-routine/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@ -0,0 +1,11 @@
|
||||
import { createStore, applyMiddleware } from 'redux';
|
||||
import createMiddleware from '@wordpress/redux-routine';
|
||||
|
||||
const middleware = createMiddleware({
|
||||
FOO: action => action.foo,
|
||||
BAR(action) {
|
||||
return action.bar;
|
||||
},
|
||||
});
|
||||
|
||||
const store = createStore(state => state, applyMiddleware(middleware));
|
||||
Loading…
Reference in New Issue
Block a user