JetBrains Rider 2018.1 Help

Code Inspections in TypeScript

InspectionDescriptionDefault Severity
Equality operator may cause type coercion

This inspection reports usages of JavaScript equality operators which may cause unexpected type coercions.It is considered a good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and != .

Depending on the option selected, this will either highlight:

  • All usages of == and != operators.
  • All usages except comparison with null. Some code styles allow using x == null as a replacement for x === null || x === undefined .
  • Only suspicious expressions, such as: == or != comparisons to 0 , '' , null , true , false , or undefined .

Disabled
Type mismatch

Checks TypeScript called function parameters, return values, assigned expressions to be of correct type.

Error
Type mismatch in 'any' type context

Checks TypeScript called function parameters, return values, assigned expressions to be of correct type in 'any' type context.

Weak warning
Unresolved JavaScript variable

Checks TypeScript referenced variables and fields to be valid ones.

Weak warning
Validate imports

Validate TypeScript imports

Error
Unresolved JavaScript function

Checks TypeScript called functions to be valid ones.

Weak warning
@private and @protected members accessibility

This inspection checks that TypeScript private and protected members are visible in current context.

Weak warning
Import can be shortened

This inspection reports any instances of ES6 importswhose 'from' part can be shortened by importing the parent directory.

Warning
Reference to a UMD global

Report the use of references to a UMD global if the current file is a module.

Weak warning
Field is assigned only in the constructor and can be made readonly

If a private field is assigned only in the constructor, it can be made readonly.

Weak warning
Unsound 'typeof' type guard check

'typeof x' type guard can be unsound in one of the following two cases:

  1. typeof x never corresponds to the specified value (e.g., typeof x === 'number' when 'x' is 'string | boolean')
  2. typeof x always corresponds to the specified value (e.g., typeof x === 'string' when 'x' is 'string')

Warning
Unsound 'instanceof' type guard check

'x instanceof A' type guard can be unsound in one of the following two cases:

  1. Type of x is not related to 'A'
  2. Type of x is 'A' or a subtype of 'A'

Warning
Missing augmentation import

Check that current file imports the augmentation module

Information
Explicit member types

Allows to configure code style of declarations (local variables, functions, fields).Default behavior is to highlight as redundant type declarations that match the inferred type.'Prefer explicit types' option inverts this and suggests inserting an explicit type declaration even where the type can be inferred.

Information
Suspicious parameter assignment in constructor

Warns against a common mistake in TypeScript code, when a class field is declared as a constructor parameter, and then this parameter is assigned.
In this case, the corresponding field won't be assigned, only the local parameter value is modified.

Warning
Abstract class constructor can be made protected

Suggests to make the constructor of an abstract class protected (because it is useless to have it public)

Weak warning
TSLint

Runs TsLint - a linter for the TypeScript language.

Disabled
Last modified: 20 August 2018