Update example code due to deprecations in RxJS
See original GitHub issueWhich @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.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Deprecations - RxJS
Deprecations link ; multicast, Will be removed in v8. Use the connectable observable, the connect operator or the share operator instead. See the...
Read more >Subscribe is deprecated: Use an observer instead of an error ...
subscribe isn't deprecated, only the variant you're using is deprecated. In the future, subscribe will only take one argument: either the ...
Read more >Deprecated APIs and features - Angular
To help you future-proof your projects, the following table lists all deprecated APIs and features, organized by the release in which they are...
Read more >RxJS heads up: toPromise is being deprecated - InDepth.Dev
In RxJS 7 toPromise will become deprecated and with RxJS 8 it will be gone! So avoid using toPromise in your future development...
Read more >RxJS 6: What's new and what has changed? - Auth0
In the rare instance that your codebase defines its own TypeScript prototype operators and modifies the Observable namespace, your operator code ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep
“docs(examples): update deprecated form of the tap operator” looks fine now?