Sitelet https://web.archive.org/web/20260326051029/https://github.com/angular/angular/issues/44708
Skip to content

Update example code due to deprecations in RxJS #44708

@DoktorZAG

Description

@DoktorZAG

Which @angular/* package(s) are relevant/releated to the feature request?

No response

Description

In documentation in example codes there are many usages of RxJS.
Several functions are going to be deprecated or already deprecated and will be removed in next major release.

For example in developer guide for HTTP Client, interceptors part (Logging request and response pairs) the following code-snippet with tap-function uses deprecated form of the tap:

...
tap(
  // Succeeds when there is a response; ignore other events
  event => ok = event instanceof HttpResponse ? 'succeeded' : '',
  // Operation failed; error is an HttpErrorResponse
  error => ok = 'failed'
),
...

The deprecation note for the function used: "Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments"

See more for details: https://rxjs.dev/api/operators/tap

Proposed solution

The replacement of the provided snippet by the following:

...
tap({
  next: event => ok = event instanceof HttpResponse ? 'succeeded' : '',
  error: error => ok = 'failed'
}),
...

Alternatives considered

No alternatives.

Metadata

Metadata

Assignees

Labels

good first issueLabel noting a good first issue to be worked on by a community memberopen for contributionsAn issue that is suitable for a community contributor (based on its complexity/scope).

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions