Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 609 Bytes

no-create.md

File metadata and controls

29 lines (21 loc) · 609 Bytes

Avoid the static create function (no-create)

This rule prevents the use of the static create function in Observable. Developers should use new and the constructor instead.

Rule details

Examples of incorrect code for this rule:

const answers = Observable.create(subscriber => {
  subscriber.next(42);
  subscriber.next(54);
  subscriber.complete();
});

Examples of correct code for this rule:

const answers = new Observable<number>(subscriber => {
  subscriber.next(42);
  subscriber.next(54);
  subscriber.complete();
});

Options

This rule has no options.