Search code examples
intellij-idearxjsdeprecated

delayWhen is deprecated RxJs


I got a Deprecated symbol used ... warning inside my IDE for using delayWhen in my app.

enter image description here

My code:

private nextImg(): Observable<void> {
    return this.stream$.pipe(
          delayWhen(() => timer(1000),
          tap(() => this.subject.next(NEXT_IMG)),
         );
}

I've checked the source code of the delayWhen operator and the docs as well, but I can't find what to use instead of delayWhen. Any idea?


Solution

  • The delayWhen operator isn't deprecated, only the function overload is marked as deprecated.

    @deprecated In future versions, empty notifiers will no longer re-emit the source value on the output observable.

    So your IDE mistakenly marks the hole operator as deprecated.