{"id":10416,"library":"rxjs","title":"RxJS: Reactive Extensions for JavaScript","description":"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.","status":"active","version":"7.8.2","language":"javascript","source_language":"en","source_url":"https://github.com/reactivex/rxjs","tags":["javascript","Rx","RxJS","ReactiveX","ReactiveExtensions","Streams","Observables","Observable","Stream","typescript"],"install":[{"cmd":"npm install rxjs","lang":"bash","label":"npm"},{"cmd":"yarn add rxjs","lang":"bash","label":"yarn"},{"cmd":"pnpm add rxjs","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"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.","wrong":"const { Observable } = require('rxjs');","symbol":"Observable","correct":"import { Observable } from 'rxjs';"},{"note":"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'.","wrong":"import { map, filter } from 'rxjs/operators';","symbol":"of, map, filter","correct":"import { of, map, filter } from 'rxjs';"},{"note":"Import `Subject` directly from the 'rxjs' module. Importing from internal paths is not recommended as they are subject to change without major version bumps.","wrong":"import { Subject } from 'rxjs/internal/Subject';","symbol":"Subject","correct":"import { Subject } from 'rxjs';"}],"quickstart":{"code":"import { range, filter, map, Observable } from 'rxjs';\n\n// Create an observable that emits numbers from 1 to 200\nconst source$: Observable<number> = range(1, 200);\n\n// Pipe operators to transform the stream\nconst processedStream$ = source$.pipe(\n  filter(x => x % 2 === 1), // Keep only odd numbers\n  map(x => x + x)           // Double each odd number\n);\n\n// Subscribe to the stream to receive values and log them\nconsole.log('Starting stream subscription...');\nprocessedStream$.subscribe({\n  next: x => console.log(`Received: ${x}`), // Log each emitted value\n  error: err => console.error('An error occurred:', err), // Handle errors\n  complete: () => console.log('Stream completed.') // Log when the stream finishes\n});\n\n// Example of a simple timer to show asynchronous nature\nimport { timer } from 'rxjs';\n\ntimer(2000, 1000).subscribe(val => console.log(`Timer tick: ${val}`));","lang":"typescript","description":"Demonstrates creating an Observable, applying pipeable operators (`filter`, `map`), and subscribing to process data, along with a basic timer example."},"warnings":[{"fix":"Update your imports: `import { of, map, filter } from 'rxjs';` instead of `import { map, filter } from 'rxjs/operators';`","message":"Starting 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.","severity":"breaking","affected_versions":">=7.2"},{"fix":"Instead of `Subject.create(observer)`, directly instantiate a `Subject` and manage subscriptions and emissions: `const subject = new Subject();`","message":"RxJS v8 (currently in alpha) removes the `Subject.create` static method. This method was deprecated in previous versions.","severity":"breaking","affected_versions":">=8.0.0-alpha.13"},{"fix":"If you relied on `Symbol.observable` for interop, consider alternative strategies or check for updated guidance on observable interop in RxJS 8.","message":"RxJS v8 (currently in alpha) removes the `Symbol.observable` export.","severity":"breaking","affected_versions":">=8.0.0-alpha.13"},{"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.","message":"In RxJS v8 (currently in alpha), `WebSocketSubject` no longer extends `Subject`. This changes its inheritance chain and may impact assumptions about its API.","severity":"breaking","affected_versions":">=8.0.0-alpha.13"},{"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.","message":"Migrating 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.","severity":"gotcha","affected_versions":">=7.0.0"}],"env_vars":null,"search_vec":"'7.8.2':48 '8':55 'activ':50 'allow':73 'alpha':60 'applic':150 'approach':135 'array':99 'asynchron':17,34,138 'base':21,130,134 'break':66 'callback':129 'callback-bas':128 'chang':67 'choic':125 'code':42 'combin':106 'complex':33 'compon':143 'compos':16 'consum':83 'core':142 'current':44,58 'data':74,107 'declar':29 'develop':51 'differ':86 'differenti':95 'emit':77 'emphasi':115 'event':20 'event-bas':19 'extens':3,8 'filter':104 'form':140 'framework':148 'fundament':85 'includ':96 'intric':137 'introduc':62 'iter':92 'javascript':5,10,155 'key':94 'lead':36 'leverag':152 'librari':14 'maintain':41 'make':121 'manag':32 'mani':145 'model':72,90 'modern':146 'modular':119 'multipl':78 'observ':24,161,162 'oper':35,101 'optim':64 'paradigm':30 'perform':117 'power':13 'prefer':124 'produc':75 'program':22,154 'progress':52 'promis':133 'promise-bas':132 'provid':27 'pull':89 'push':71 'reactiv':2,7,153 'reactiveextens':159 'reactivex':158 'readabl':39 'rich':98 'robust':109 'rx':156 'rxjs':1,6,68,157 'scenario':139 'sequenc':25 'stabl':45 'stream':108,160,163 'strong':114 'support':111 'time':81 'toward':53 'tradit':127 'transform':103 'typescript':110,164 'use':23 'util':69 'valu':79 'version':46,54 'web':147","created_at":"2026-04-18T08:58:41.186250+00:00","updated_at":"2026-04-19T05:46:55.857306+00:00","problems":[{"fix":"Change the import to `import { map } from 'rxjs';` (and similarly for other operators).","cause":"Attempting to import `map` from 'rxjs/operators' in RxJS 7.2 or higher, where it's no longer exported from that path.","error":"TypeError: (0, rxjs_operators_1.map) is not a function"},{"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.","cause":"Attempting to call `.subscribe()` on a variable that is `undefined`, often due to an incorrect observable creation or a `null` value being returned unexpectedly.","error":"TypeError: Cannot read properties of undefined (reading 'subscribe')"},{"fix":"Update all imports from `rxjs/operators` to `rxjs`. For example, `import { map } from 'rxjs/operators';` becomes `import { map } from 'rxjs';`.","cause":"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.","error":"TS2307: Cannot find module 'rxjs/operators' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":"https://rxjs.dev","github":"https://github.com/reactivex/rxjs","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/rxjs","openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}