- Declare types for function return values
- Do absolutely everything in your power to avoid
any
- Read this post. In here lies your proximate problem -
get
is a “class C” function, and so it must be declared to return aPromise
(orObservable
), and its first word should bereturn
. You have some design leeway for whatstore
andremove
are, but need to be aware of the consequences of the choices
So I would write get
like this, which should give you an idea of how to fix the rest of StorageService
:
get<T>(key: string): Promise<T> {
return this.storage.ready().then(() => this.storage.get(key));
}