[IMP] redux-storage: support v4.1.2 (#35197)

This commit is contained in:
Alexey Pelykh
2019-05-04 00:55:12 -07:00
committed by Wesley Wigham
parent 87735e29a5
commit 6897ae2bf1
5 changed files with 16 additions and 6 deletions
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/axe312ger/redux-storage-engine-jsurl
// Definitions by: Christian Rackerseder <https://github.com/screendriver>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { StorageEngine } from 'redux-storage';
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/react-stack/redux-storage-engine-localstorage
// Definitions by: Christian Rackerseder <https://github.com/screendriver>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { StorageEngine } from "redux-storage";
+11 -3
View File
@@ -1,7 +1,9 @@
// Type definitions for redux-storage 4.0.1
// Project: https://github.com/michaelcontento/redux-storage
// Type definitions for redux-storage 4.1.2
// Project: https://github.com/react-stack/redux-storage
// Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>
// Alexey Pelykh <https://github.com/alexey-pelykh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="redux" />
@@ -40,13 +42,19 @@ declare module "redux-storage" {
*/
export function reducer<TState>(reducer: Reducer<TState>, merger?: StateMerger): Reducer<TState>;
/**
* Callback that checks action type
* @param type
*/
export type ActionTypeCheckCallback = (type: string) => boolean
/**
* Create storage middleware
* @param engine
* @param actionBlacklist
* @param actionWhitelist
*/
export function createMiddleware(engine: StorageEngine, actionBlacklist?: string[], actionWhitelist?: string[]): Middleware;
export function createMiddleware(engine: StorageEngine, actionBlacklist?: string[], actionWhitelist?: string[] | ActionTypeCheckCallback): Middleware;
/**
* Loader interface
+1 -1
View File
@@ -1,6 +1,6 @@
{
"private": true,
"dependencies": {
"redux": "^3.6.0"
"redux": "^3.6.0 || ^4.0.0"
}
}
+2 -2
View File
@@ -23,7 +23,7 @@ const initialStateLoader = createLoader(storageEngine);
const storageMiddleware = createMiddleware(storageEngine, [], []);
const store = applyMiddleware(storageMiddleware)<TestState>(createStore)(enhancedReducer);
const store = applyMiddleware(storageMiddleware)(createStore)(enhancedReducer);
initialStateLoader(store).then(() => {
// render app
@@ -33,7 +33,7 @@ initialStateLoader(store).then(() => {
// Test for React Native Async Storage engine
const storageEngineReactNative = createReactNativeAsyncStorageEngine("test");
const storageMiddlewareReactNative = createMiddleware(storageEngine);
const storeReactNative = applyMiddleware(storageMiddlewareReactNative)<TestState>(createStore)(enhancedReducer);
const storeReactNative = applyMiddleware(storageMiddlewareReactNative)(createStore)(enhancedReducer);
initialStateLoader(storeReactNative).then(() => {
// render app
})