💼 This rule is enabled in the following configs: ✅ recommended
, 🔒 strict
.
💭 This rule requires type information.
This rule effects failures if next
is called without an argument and the subject's value type is not void
.
In RxJS version 6, the next
method's value
parameter was optional, but a value should always be specified for subjects with non-void
element types.
RxJS version 7 changed the value
parameter to mandatory.
Examples of incorrect code for this rule:
const subject = new Subject<number>();
subject.next();
Examples of correct code for this rule:
const subject = new Subject<void>();
subject.next();
const subject = new Subject<number>();
subject.next(0);
If you don't care about sending undefined
to subjects, then you don't need this rule.
Alternatively, you may rely on TypeScript to enforce the value
parameter,
which was made mandatory in RxJS version 7.
Type checked lint rules are more powerful than traditional lint rules, but also require configuring type checked linting.