Which is the best approach to upgrade rxjs to version 7 in an angular 13 library? the library should still be usable by projects with rxjs6
Asked Answered
C

1

8

Which is the best approach to upgrade rxjs to version 7 in an angular 13 library? the library should still be usable by projects with rxjs6

I noticed that for the upgrade from rxjs6 to rxjs7 there isn't a compatibility library like the one i used for the upgradete from rxjs 5 to rxjs 6.

I would like to update projects and libraries indipendently by each other but rxjs6 and rxjs7 are incompatibile

Crematorium answered 9/5, 2022 at 11:32 Comment(0)
A
4

Just do an upgrade and see if anything breaks for you.

5 to 6 was a very different upgrade than 6 to 7. The vast majority of 6 code will work in 7. The big thing with 5 to 6 was the pipe operator where functions were moved out of the main observable class into tree shakeable includes so there was a need for the compatibility library. Using the upgrade compatibility library was not a good approach back then, the best approach was to fix your code. You could easily fix a large codebase in a few hours.

Here are the breaking changes in version 7, you will have to work out which ones affect your library and if you can make any incompatibilities work with 6 on a case by case basis.

https://rxjs.dev/deprecations/breaking-changes

It really all depends on the code you have in your codebase. My personal libraries didn't need any work when 7 first came out, they just worked without refactoring a single line of code. I just did an npm upgrade rxjs and it built and all my unit tests passed. Happy times.

Atlantic answered 18/8, 2022 at 13:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.