Skip to content

fix: add RxJS as peer dependency#886

Closed
yogeshchoudhary147 wants to merge 1 commit intomainfrom
fix/add-rxjs-peer-dependency
Closed

fix: add RxJS as peer dependency#886
yogeshchoudhary147 wants to merge 1 commit intomainfrom
fix/add-rxjs-peer-dependency

Conversation

@yogeshchoudhary147
Copy link
Copy Markdown
Contributor

Problem

@auth0/auth0-angular imports from rxjs and exposes RxJS types (Observable) in its public API, but does not declare RxJS as a peer dependency. In strict package managers (pnpm, Yarn PnP), this allows multiple RxJS versions to coexist, causing TypeScript type incompatibilities at API boundaries (interceptors, guards).

Solution

Add rxjs as a peer dependency with the same version range that @angular/core uses (^6.5.3 || ^7.4.0). This ensures package managers dedupe to a single RxJS version shared with the app.

Impact

  • Zero breaking changes — every Angular app already has RxJS installed
  • Zero behavior changes — metadata only
  • Aligns with how @angular/core, @angular/common, @angular/router, @ngrx/store, etc. all declare RxJS

Testing

All 131 tests pass.

Fixes #670

## Problem

auth0-angular directly imports from `rxjs` and exposes RxJS types
(`Observable`) in its public API, but doesn't declare RxJS as a
dependency. This causes TypeScript errors in monorepos with strict
package managers (pnpm, Yarn PnP) when multiple RxJS versions exist.

## Root Cause

Without declaring RxJS as a peer dependency, package managers don't
know that auth0-angular requires RxJS to be present and should dedupe
it with the app's RxJS version. In pnpm's strict isolation mode, this
allows multiple RxJS versions to coexist, causing type incompatibilities
at API boundaries (interceptors, guards).

## Solution

Add RxJS as a peer dependency with the same version range that Angular
itself uses (`^6.5.3 || ^7.4.0`). This ensures:
- Package managers know auth0-angular needs RxJS
- They dedupe to a single version shared across the app
- Type compatibility at API boundaries

## Testing

Reproduced the issue in a fresh Nx monorepo with pnpm:
- ✅ Without peer dependency: TypeScript errors with dual RxJS versions
- ✅ With peer dependency: Builds successfully with single RxJS version

Fixes #670

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@yogeshchoudhary147 yogeshchoudhary147 requested a review from a team as a code owner April 3, 2026 04:37
@yogeshchoudhary147
Copy link
Copy Markdown
Contributor Author

Closing as this turned out to be a monorepo setup issue rather than an SDK bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RxJS versions compatibility issue: 7.8.1 vs 7.8.2

1 participant