LocalForageWrapper is currently typed as string | object | null, but it solely depends on whether we serialize or not.
Also, localForage (and IndexedDB) supports storing more than string or object, it supports the following JS objects:
Array
ArrayBuffer
Blob
Float32Array
Float64Array
Int8Array
Int16Array
Int32Array
Number
Object
Uint8Array
Uint8ClampedArray
Uint16Array
Uint32Array
String
I didn't want to introduce a breaking change by changing the type, so instead, I turned LocalForageWrapper into a generic class expecting a type for LocalForage and defaulting to string | object | null (current value).
It means that if you're storing binary data in IndexedDB, you can provide the type as such: LocalForageWrapper<Uint8Array>.
LocalForageWrapper
is currently typed asstring | object | null,
but it solely depends on whether we serialize or not.Also,
localForage
(and IndexedDB) supports storing more thanstring
orobject
, it supports the following JS objects:I didn't want to introduce a breaking change by changing the type, so instead, I turned
LocalForageWrapper
into a generic class expecting a type for LocalForage and defaulting tostring | object | null
(current value).It means that if you're storing binary data in IndexedDB, you can provide the type as such:
LocalForageWrapper<Uint8Array>
.