The most well-known and widely used library of reactive programming in JavaScript is RxJS. So much so that the number of downloads per week today is around 25 million (2.3x React, 9.7x Angular, 11x Vue). We have been using RxJS 6 for 3 years. RxJS 7, whose first alpha version was released in September 2019, was released six days ago. So what are the changes awaiting us in RxJS 7? What are the differences between RxJS 7 and 6? Should we switch to RxJS 7?

TypeScript, size, memory, and speed in RxJS 7

Better types

One of the major changes to RxJS 7 is perhaps the least noticeable. When we look at the changelog, we see that there is a lot of work on the types. Especially, efforts on the following subjects stand out:

  • Functions that take n parameters, such as of, can now correctly infer types even when over 8-9 parameters are passed to them.
import { of } from "rxjs";

// Observable<string, number> (in RxJS 6 → No overload matches this call)
of(0, "A", 1, "B", 2, "C", 3, "D", 4, "E", 5, "F", 6, "G", 7, "H", 8, "I", 9, "...");

#rxjs #javascript #typescript

What’s New in RxJS 7
1.75 GEEK