Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 631 Bytes

no-nested-subscribe.md

File metadata and controls

30 lines (20 loc) · 631 Bytes

Avoid nested subscribe calls (no-nested-subscribe)

This rule effects failures if subscribe is called within a subscribe handler.

Rule details

Examples of incorrect code for this rule:

import { of, timer } from "rxjs";

of(42, 54).subscribe((value) => {
  timer(1e3).subscribe(() => console.log(value));
});

Examples of correct code for this rule:

import { of, timer } from "rxjs";
import { mapTo, mergeMap } from "rxjs/operators";

of(42, 54).pipe(
  mergeMap((value) => timer(1e3).pipe(mapTo(value)))
).subscribe((value) => console.log(value));

Options

This rule has no options.