'How to add redux-persist to typescript project?

I'm trying to add redux-persist to my React project (using typescript). But I have some trouble. Compiling falls with following error:

Could not find a declaration file for module 'redux-persist/lib/storage'. '.../WebstormProjects/catalog/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/lib/storage'

I installed the following packages: "@types/redux-persist": "^4.3.1" and "redux-persist": "^6.0.0".

Content of redux-persist/lib/storage:

declare module "redux-persist/es/storage" {
  import { WebStorage } from "redux-persist/es/types";

  const localStorage: WebStorage;
  export default localStorage;
}

declare module "redux-persist/lib/storage" {
  export * from "redux-persist/es/storage";
  export { default } from "redux-persist/es/storage";
}

What to do to solve this problem?



Solution 1:[1]

Solution:

import storage of import storage from 'redux-persist/es/storage' and not import storage from 'redux-persist/lib/storage'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alan Fabian Herrera Gomez