rxjs7
lastValueFrom(of('foo'));
https://indepth.dev/posts/1287/rxjs-heads-up-topromise-is-being-deprecated
rxjs6
https://github.com/ReactiveX/rxjs/issues/2868#issuecomment-360633707
Don’t pipe. It’s on the Observable object by default.
Observable.of('foo').toPromise(); // this
rxjs5
import 'rxjs/add/operator/toPromise';
import 'rxjs/add/operator/map';
...
this._APIService.getAssetTypes()
.map(assettypes => {
this._LocalStorageService.setAssetTypes(assettypes);
})
.toPromise()
.catch(err => {
this._LogService.error(JSON.stringify(err));
});