DEV Community

loading...

Discussion on: RxJS 7 is released 🎉

Collapse
vazsonyidl profile image
vazsonyidl Author

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 :

    this.items = await this.itemService
      .getItems()
      .toPromise()
Enter fullscreen mode Exit fullscreen mode

Now you can use this instead:

    const items$ = this.itemService.getItems();
    this.items = await lastValueFrom(items$);
Enter fullscreen mode Exit fullscreen mode

I hope I can help you, but reply if do not. :)

Collapse
lyrod profile image
Lyrod • Edited

This is exactly what I do in my tests! Thanks!