I don't understand the toPromise deprecation. You can't convert an observable to a promise?
It was helpful for unit tests
It depends on your test setup, without any other info it is hard to reply. :( Maybe you could give a try for lastValueFrom instead of toPromise as it is planned to replace that one-in-one.
lastValueFrom
Or if your setup was something like this one :
this.items = await this.itemService .getItems() .toPromise()
Now you can use this instead:
const items$ = this.itemService.getItems(); this.items = await lastValueFrom(items$);
I hope I can help you, but reply if do not. :)
This is exactly what I do in my tests! Thanks!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I don't understand the toPromise deprecation. You can't convert an observable to a promise?
It was helpful for unit tests
It depends on your test setup, without any other info it is hard to reply. :( Maybe you could give a try for
lastValueFrom
instead of toPromise as it is planned to replace that one-in-one.Or if your setup was something like this one :
Now you can use this instead:
I hope I can help you, but reply if do not. :)
This is exactly what I do in my tests! Thanks!