Typescript type definition error with localForage
See original GitHub issueI am unable to use localForage with redux-persist in a typescript project
My import statements:
import { persistStore, autoRehydrate } from 'redux-persist'
import * as localForage from 'localforage'
Calling persistStore as:
persistStore(store, { storage: localForage })
Results in the following compilation error:
Argument of type ‘{ storage: LocalForage; }’ is not assignable to parameter of type ‘PersistorConfig | undefined’. Type ‘{ storage: LocalForage; }’ is not assignable to type ‘PersistorConfig’. Types of property ‘storage’ are incompatible. Type ‘LocalForage’ is not assignable to type ‘Storage | undefined’. Type ‘LocalForage’ is not assignable to type ‘Storage’. Property ‘getAllKeys’ is missing in type ‘LocalForage’.
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (9 by maintainers)
Top Results From Across the Web
Typescript type definition error with localForage - - Bountysource
I am unable to use localForage with redux-persist in a typescript project. My import statements: import { persistStore, autoRehydrate } from ...
Read more >typescript - localForage type is unkown - Stack Overflow
const x has a syntax error: Type 'unknown' is not assignable to type 'string[]'. The value parameter in the then callback is of...
Read more >Cannot find type definition file for 'localforage' - Ionic Framework
I did install typings and localforage in hope to solve this issue but… ... typescript error [app-scripts] Cannot find type definition file ......
Read more >@types/localforage | Yarn - Package Manager
Stub TypeScript definitions entry for localforage, which provides its own types definitions ... You can now catch errors thrown by dropInstance , see...
Read more >localforage - npm
TypeScript icon, indicating that this package has built-in type declarations ... (err) { // if err is non-null, we got an error localforage....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Awesome, thanks for having a quick look at it! I just merged the PR and the next release will contain the updated typings 👍
@Dante-101 I do not use typescript, but my guess is this should be solved by making sure localForage is typed correctly. Open to suggestions