redux-persist: typescript incompatible with latest version of redux-persist
Versions: TS: 2.7.1 redux-persist: 5.6.5
All of the sub directory imports are not possible when using typescript with redux-persist. Example:
import storage from 'redux-persist/lib/storage'
// error:
[ts]
Could not find a declaration file for module 'redux-persist/lib/storage'. '.../node_modules/redux-persist/lib/storage/index.js' implicitly has an 'any' type.
Try `npm install @types/redux-persist` if it exists or add a new declaration (.d.ts) file containing `declare module 'redux-persist';`
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (6 by maintainers)
still an issue on “redux-persist”: “5.9.1”
I resolved this by adding
to the
tsconfig.jsonfile.Still not working 6.0
npm i --save @types/reactclears up the build error.Getting an error with
lib/integration/reactas well. Adding this to index.d.ts fixes it.@i8wu can you try 5.6.11
and change your import from
redux-persist/lib/integration/reacttoredux-persist/integration/react(i.e. drop the lib)redux-persist v5 does not have a autoRehydrate method. Also it ships with its own type definitions so you should not need to install them from a different source.
@yordis I am not sure about these errors - does #706 resolve the first?
For the second it seems like maybe we need to move the type definitions for react integration out of index.d.ts and into the proxy module: https://github.com/rt2zz/redux-persist/tree/master/integration/react
Again I am not a TS user so I can only speculate, but will gladly merge fixes and cut a new release.