Files
MyAiConfiguration/shared/rules/angular/references/rxjs.md
T
Julian LechnerandClaude Opus 5.5 b6c33780c3 docs(rules): update TypeScript and Angular rules for TS 7 and trim duplicates
TypeScript 7.0 ships the native compiler as tsc and drops options
deprecated in 6.0. Angular 22 still requires TypeScript >=6.0.0 <6.1.0,
so both rule sets now warn against moving Angular projects to TS 7, and
the Angular index asks to check the Angular version first.

TypeScript runtime safety adds error handling (Error objects only,
cause chaining, unknown in catch, one error model per layer, no
swallowed errors) plus exact decimals for money, ISO 8601 UTC dates, and
Intl formatting. Angular adds per-route SSR render modes, a global
ErrorHandler with provideBrowserGlobalErrorListeners, and translatable
text with locale-aware formatting.

Generic guidance that the TypeScript, refactoring, and UI/UX rules
already cover is removed from the Angular rules, which shrink by about
7.5 percent despite the additions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 10:08:25 +01:00

1013 B

Angular RxJS

Apply these rules when writing or changing RxJS streams, subscriptions, or signal and observable interop in Angular.

RxJS

  • Use RxJS for asynchronous streams, events and complex reactive flows.
  • Do not use RxJS when simple synchronous signals are sufficient.
  • Prefer declarative observable pipelines.
  • Avoid nested subscribe.
  • Avoid manual subscriptions where async, signals or framework helpers are sufficient.
  • Bind every manual subscription's lifetime with takeUntilDestroyed or equivalent Angular lifecycle integration to avoid leaks.
  • Choose the flattening operator for its semantics; switchMap, mergeMap, concatMap, and exhaustMap are not interchangeable.
  • Avoid unnecessary Subject usage.
  • Prefer exposing observables instead of exposing mutable subjects.
  • Prefer BehaviorSubject only when a current value is actually required.
  • Avoid excessive observable chains for simple state.
  • Avoid converting repeatedly between signals and observables without need.