import { PersistentStorage } from '../types' ; export class LocalForageWrapper implements PersistentStorage < string | object | null > { private storage ; constructor ( storage ) { this . storage = storage ; } getItem ( key ) { return this . storage . getItem ( key ) ; } removeItem ( key ) { return this . storage . removeItem ( key ) ; } setItem ( key , value ) { return new Promise ( ( resolve , reject ) => { this . storage . setItem ( key , value ) . then ( ( ) => resolve ( ) ) . catch ( ( ) => reject ( ) ) ; } ) ; } } interface LocalForageInterface { getItem ( key ) : Promise < string | null > ; setItem ( key , value ) : Promise < string | object | null > ; removeItem ( key ) : Promise < void > ; }