question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript type definition error with localForage

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
marvinhagemeistercommented, Feb 12, 2017

Awesome, thanks for having a quick look at it! I just merged the PR and the next release will contain the updated typings 👍

1reaction
rt2zzcommented, Feb 9, 2017

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found