I am using angular, so typescript, and try to return a promise from an observable.
What is the right way to do this?
I tried:
of(EMPTY).toPromise() // error: Promise<Observable<never>>' is not assignable to type Promise<void>
of(null).toPromise() // no error but not sure if it is the right way
of().toPromise // error: Promise<Observable<unknown>>' is not assignable to type Promise<void>
Update:
// this is the interface that declares it
export interface CustomStoreOptions extends StoreOptions<CustomStore> {
/** Specifies a custom implementation of the remove(key) method. */
remove?: ((key: any | string | number) => Promise<void> | JQueryPromise<void>);
}
so it is called:
let store = new CustomStore({
remove: key => {
// return ...
}
});