Registry / http-networking / rxjs
library7.8.2jsnpmunverified

RxJS (Reactive Extensions for JavaScript) is a powerful library for composing asynchronous and event-based programs using observable sequences. It provides a declarative paradigm for managing complex asynchronous operations, leading to more readable and maintainable code. The current stable version is 7.8.2, with active development progressing towards version 8, which is currently in alpha and introduces further optimizations and breaking changes. RxJS utilizes a "push" model, allowing data producers to emit multiple values over time to consumers, a fundamental difference from the "pull" model of iterators. Its key differentiators include a rich array of operators for transforming, filtering, and combining data streams, robust TypeScript support, and a strong emphasis on performance and modularity. This makes it a preferred choice over traditional callback-based or Promise-based approaches for intricate asynchronous scenarios, forming a core component in many modern web frameworks and applications that leverage reactive programming.

npm install rxjs
INSTALL
IMPORT
SIG · RXJS
R
rxjs
http-networkingjavascriptv7.8.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Observable
import { Observable } from 'rxjs';
const { Observable } = require('rxjs');
While CommonJS `require` works for UMD bundles in some environments, modern Node.js and browser build setups typically use ESM `import`. For core classes, use named imports.
of, map, filter
import { of, map, filter } from 'rxjs';
import { map, filter } from 'rxjs/operators';
Since RxJS v7.2, all creation functions (like `of`) and pipeable operators (like `map`, `filter`) are exported directly from the top-level 'rxjs' module. Prior to v7.2, operators were imported from 'rxjs/operators'.
Subject
import { Subject } from 'rxjs';
import { Subject } from 'rxjs/internal/Subject';
Import `Subject` directly from the 'rxjs' module. Importing from internal paths is not recommended as they are subject to change without major version bumps.

Demonstrates creating an Observable, applying pipeable operators (`filter`, `map`), and subscribing to process data, along with a basic timer example.

import { range, filter, map, Observable } from 'rxjs'; // Create an observable that emits numbers from 1 to 200 const source$: Observable<number> = range(1, 200); // Pipe operators to transform the stream const processedStream$ = source$.pipe( filter(x => x % 2 === 1), // Keep only odd numbers map(x => x + x) // Double each odd number ); // Subscribe to the stream to receive values and log them console.log('Starting stream subscription...'); processedStream$.subscribe({ next: x => console.log(`Received: ${x}`), // Log each emitted value error: err => console.error('An error occurred:', err), // Handle errors complete: () => console.log('Stream completed.') // Log when the stream finishes }); // Example of a simple timer to show asynchronous nature import { timer } from 'rxjs'; timer(2000, 1000).subscribe(val => console.log(`Timer tick: ${val}`));
Debug
Known issues
breakingStarting with RxJS v7.2, all creation functions and pipeable operators are exported directly from the main 'rxjs' package. Importing operators from 'rxjs/operators' is deprecated and will not work in newer versions.
fix
Update your imports: `import { of, map, filter } from 'rxjs';` instead of `import { map, filter } from 'rxjs/operators';`
affects: >=7.2
breakingRxJS v8 (currently in alpha) removes the `Subject.create` static method. This method was deprecated in previous versions.
fix
Instead of `Subject.create(observer)`, directly instantiate a `Subject` and manage subscriptions and emissions: `const subject = new Subject();`
affects: >=8.0.0-alpha.13
breakingRxJS v8 (currently in alpha) removes the `Symbol.observable` export.
fix
If you relied on `Symbol.observable` for interop, consider alternative strategies or check for updated guidance on observable interop in RxJS 8.
affects: >=8.0.0-alpha.13
breakingIn RxJS v8 (currently in alpha), `WebSocketSubject` no longer extends `Subject`. This changes its inheritance chain and may impact assumptions about its API.
fix
Review code that casts `WebSocketSubject` to `Subject` or relies on `Subject` methods directly. Adjust usage to use `WebSocketSubject`'s specific API, or use a new `Subject` instance to bridge if `Subject` functionality is still required.
affects: >=8.0.0-alpha.13
gotchaMigrating from RxJS 6 to 7 introduced several breaking changes beyond just operator imports, including changes to `lift`, default schedulers, and error handling. Code written for RxJS 6 may not directly compile or run correctly in RxJS 7.
fix
Consult the official migration guide from RxJS 6 to 7 (often linked on the RxJS website or GitHub repository) for a comprehensive list of changes and recommended updates.
affects: >=7.0.0
Errors
Common errors & fixes
TypeError: (0, rxjs_operators_1.map) is not a function
Attempting to import `map` from 'rxjs/operators' in RxJS 7.2 or higher, where it's no longer exported from that path.
fix
Change the import to `import { map } from 'rxjs';` (and similarly for other operators).
TypeError: Cannot read properties of undefined (reading 'subscribe')
Attempting to call `.subscribe()` on a variable that is `undefined`, often due to an incorrect observable creation or a `null` value being returned unexpectedly.
fix
Ensure the variable you're calling `.subscribe()` on is indeed an `Observable` instance. Debug the preceding code to verify that an `Observable` is correctly created and assigned.
TS2307: Cannot find module 'rxjs/operators' or its corresponding type declarations.
This error occurs in TypeScript when 'rxjs/operators' is imported in RxJS 7.2+ where the module no longer exists as a separate entry point.
fix
Update all imports from `rxjs/operators` to `rxjs`. For example, `import { map } from 'rxjs/operators';` becomes `import { map } from 'rxjs';`.
Upgrade
Version history
7.8.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources