Skip to content

Commit

Permalink
Improve TypeScript definitions so we can use localStorage as a driver.
Browse files Browse the repository at this point in the history
  • Loading branch information
zewish committed Feb 14, 2021
1 parent 51e637a commit 950b263
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions index.d.ts
@@ -1,11 +1,11 @@
import { Action, PreloadedState, Reducer, Store, StoreCreator, StoreEnhancer } from 'redux';
import { Action, PreloadedState, Reducer, StoreCreator, StoreEnhancer } from 'redux';
declare const REMEMBER_REHYDRATED = "@@REMEMBER_REHYDRATED";
declare const REMEMBER_PERSISTED = "@@REMEMBER_PERSISTED";
type SerializeFunction = (data: any) => any;
type UnserializeFunction = (data: any) => any;
type Driver = {
getItem: (key: String) => any;
setItem: (key: String, value: any) => any;
getItem: (key: string) => any;
setItem: (key: string, value: any) => any;
};
type Options = {
prefix: string;
Expand All @@ -15,5 +15,5 @@ type Options = {
persistWholeStore: boolean;
};
declare const rememberReducer: (reducers: Reducer) => Reducer;
declare const rememberEnhancer: <S, A extends Action<any>, Ext>(driver: Driver, rememberedKeys: string[], { prefix, serialize, unserialize, persistThrottle, persistWholeStore }?: Partial<Options>) => (createStore: StoreCreator) => (rootReducer: Reducer<S, A>, initialState?: PreloadedState<S> | undefined, enhancer?: StoreEnhancer<Ext, {}> | undefined) => Store<S, A> & Ext;
declare const rememberEnhancer: <S, A extends Action<any>, Ext>(driver: Driver, rememberedKeys: string[], { prefix, serialize, unserialize, persistThrottle, persistWholeStore }?: Partial<Options>) => (createStore: StoreCreator) => (rootReducer: Reducer<S, A>, initialState?: PreloadedState<S> | undefined, enhancer?: StoreEnhancer<Ext, {}> | undefined) => import("redux").Store<S, A> & Ext;
export { rememberReducer, rememberEnhancer, REMEMBER_REHYDRATED, REMEMBER_PERSISTED };
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "redux-remember",
"version": "2.1.0",
"version": "2.1.1",
"description": "Saves and loads your redux state from a key-value store of your choice",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Expand Up @@ -2,8 +2,8 @@ export type SerializeFunction = (data: any) => any;
export type UnserializeFunction = (data: any) => any;

export type Driver = {
getItem: (key: String) => any;
setItem: (key: String, value: any) => any;
getItem: (key: string) => any;
setItem: (key: string, value: any) => any;
};

export type Options = {
Expand Down

0 comments on commit 950b263

Please sign in to comment.