Skip to content

Latest commit

 

History

History
32 lines (20 loc) · 1.03 KB

no-explicit-generics.md

File metadata and controls

32 lines (20 loc) · 1.03 KB

Disallow unnecessary explicit generic type arguments (rxjs-x/no-explicit-generics)

This rule prevents the use of explicit type arguments when the type arguments can be inferred.

Rule details

Examples of incorrect code for this rule:

import { BehaviorSubject } from "rxjs";
const subject = new BehaviorSubject<number>(42);

Examples of correct code for this rule:

import { BehaviorSubject } from "rxjs";
const subject = new BehaviorSubject(42);

When Not To Use It

This rule has known problems in the latest release:

  • (#77) Type unions cause false positives e.g. new BehaviorSubject<number | null>(null) will be incorrectly caught by this rule.

Resources