Ask questionsLocalStorageWrapper broken on 0.10.0

Using the same code from the example:

And from the readme, upgrading to 0.10.0 without any code changes breaks the use of LocalStorageWrapper:

TS2322: Type 'LocalStorageWrapper' is not assignable to type 'PersistentStorage<PersistedData<NormalizedCacheObject>>'.
Types of property 'setItem' are incompatible.
Type '(key: string, value: string) => void | Promise<void>' is not assignable to type '(key: string, value: PersistedData<NormalizedCacheObject>) => void | Promise<void> | PersistedData<NormalizedCacheObject> | Promise<...>'.
Types of parameters 'value' and 'value' are incompatible.
Type 'PersistedData<NormalizedCacheObject>' is not assignable to type 'string'.
Type 'null' is not assignable to type 'string'.

The types don't seem to line up. I think the problem is that the type parameter for CachePersistor is in this case NormalizedCacheObject so the options are ApolloPersistOptions<NormalizedCacheObject> which would then expect storage: PersistentStorage<PersistedData<NormalizedCacheObject>>, whereas LocalStorageWrapper would provide PersistentStorage<string>.

By the way, it might be helpful to build the examples as part of CI to serve as a canary for when these things happen.


Answer questions blaenk

No rush at all! I simply stuck with the previous version for now, just thought I'd make you all aware of this.

Thank you and enjoy your holiday!

Github User Rank List