S
S
Slav4ka2020-01-23 14:36:53
typescript
Slav4ka, 2020-01-23 14:36:53

How to connect redux-persist to a react typescript project?

I'm trying to import storage from 'redux-persist/lib/storage' (import storage from 'redux-persist/lib/storage'), but I'm getting an 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'

@types/redux-persist installed, though not needed, redux-persist provides its own type definitions
How to include this library?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2020-01-23
@Slav4ka

Add the following line to the project something.d.ts file (react-app-env.d.ts if you are using create react app):
/// <reference types="redux-persist" />

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question