Open hdpinto opened 7 years ago
This is very important if you turn on "strict": true, in the tsconfig. I've written my own '.d.ts' file so I can get Webpack to create output. Until I come up with some sort of fix I'm done... I just put it in the node_modules/@types/redux-localstorage
and name it "index.d.ts" and the transpiler has no trouble finding it. Here's the file (I only needed the 'persistState' function. Notice, it is completely different from the above 'persistState' function type definition.
// Type definitions for redux-localstorage persistState, until a better solution becomes available
import * as Redux from "redux";
export interface ConfigRS {
key: string;
merge?: any;
slicer?: any;
serialize: (value: any, replacer?: (key: string, value: any) => any, space?: string | number) => string,
deserialize: (text: string, reviver?: (key: any, value: any) => any) => any
}
export default function persistState(paths: string | string[], config: ConfigRS): Redux.GenericStoreEnhancer;
Any updates? I'm still facing the issue redux-localstorage: 0.4.1 @types/redux-localstorage: 1.0.8
When attempting to use
persistState( ... )
type definition is incorrect, typing information is possibly out of date.Sample code throwing error:
Code works fine without
@types/redux-localstorage
installed, this is the current workaround.See index.d.ts in
@types/redux-localstorage
below: