ReSharper 2018.2 Help

Code Inspections in TypeScript

In TypeScript, ReSharper 2018.2 provides two kinds of code inspections: 140 inspections that detect errors such as broken syntax, unresolved symbols, compiler errors, etc. (you cannot configure or disable any of these inspections), and 51 proprietary code inspections, any of which you can disable or change its severity level.
These code inspections help you detect code issues in design time in all open files, and additionally they allow you to find code issues in specific scope.

Configurable TypeScript inspections are listed below, grouped by their categories.

Code Style (5 inspections)

Inspections in this category detect violations of code syntax styles. In contrast to most of other code inspections, these inspections can either detect the same code construct as a code issue or not depending on the corresponding code style rule configured on the Code Editing | [Language] | Code Style page of ReSharper options. You can also fix issues that these inspection detect, using code cleanup.

Inspection

ID

EditorConfig property

Default severity

Element has implicit 'any' type

ImplicitAnyTypeWarning

resharper_implicit_any_type_warning_highlighting

Warning

Non-compliant path style inside 'require'

WrongRequireRelativePath

resharper_wrong_require_relative_path_highlighting

Hint

Non-compliant 'public' modifier or its absense

WrongPublicModifierSpecification

resharper_wrong_public_modifier_specification_highlighting

Hint

Type of variable may be specified explicitly

SpecifyVariableTypeExplicitly

resharper_specify_variable_type_explicitly_highlighting

Hint

Type specification is redundant, because variable type is contextually determined from the type of assigned value

RedundantVariableTypeSpecification

resharper_redundant_variable_type_specification_highlighting

Hint

Common Practices and Code Improvements (4 inspections)

This category groups inspections that hunt for medium severity issues that mainly affect code readability.

Inspection

ID

EditorConfig property

Default severity

Constructor of an abstract class can be made protected

AbstractClassConstructorCanBeMadeProtected

resharper_abstract_class_constructor_can_be_made_protected_highlighting

Hint

Introducing variable will allow to apply type guard

IntroduceVariableToApplyGuard

resharper_introduce_variable_to_apply_guard_highlighting

Hint

Private class field can be made readonly

PrivateVariableCanBeMadeReadonly

resharper_private_variable_can_be_made_readonly_highlighting

Hint

String literal usage allows to create specialized overload

CreateSpecializedOverload

resharper_create_specialized_overload_highlighting

Hint

Language Usage Opportunities (9 inspections)

This category includes code inspections, mostly with the suggestion severity level, which notify you when more advanced language constructs can be used. These inspections detect syntax of outdated language versions and suggest using features from more modern language versions. For most of the supported languages, language version can be detected automatically or set manually.

Inspection

ID

EditorConfig property

Default severity

AMD module may be converted to external module

AmdExternalModule

resharper_amd_external_module_highlighting

Suggestion

Class emulation may be converted to class

Class

resharper_class_highlighting

Suggestion

CommonJs module may be converted to external module

CommonJsExternalModule

resharper_common_js_external_module_highlighting

Suggestion

Function expression may be converted to lambda expression

Lambda

resharper_lambda_highlighting

Suggestion

Immediately-invoked function expression may be converted to internal module

InternalModule

resharper_internal_module_highlighting

Suggestion

Invocation of parent class may be converted to super call

SuperCall

resharper_super_call_highlighting

Suggestion

Member assigned by a function may be converted to function member

MethodSafeThis

resharper_method_safe_this_highlighting

Suggestion

Possible overloads may be inferred by function body

OverloadSignatureInferring

resharper_overload_signature_inferring_highlighting

Hint

Use 'as' operator instead of type assertion

UseAsInsteadOfTypeCast

resharper_use_as_instead_of_type_cast_highlighting

Hint

Potential Code Quality Issues (15 inspections)

This category includes inspections that detect critical issues (code smells), mostly with Error or Warning level. This category also includes inspections that ensure localization assistance.

Inspection

ID

EditorConfig property

Default severity

Cannot resolve, probably symbol is located in inaccessible module

TsResolvedFromInaccessibleModule

resharper_ts_resolved_from_inaccessible_module_highlighting

Error

Check 'amd-dependency' the same way as require() argument

AmdDependencyPathProblem

resharper_amd_dependency_path_problem_highlighting

Disabled

Duplicate identifier

DuplicateIdentifierError

resharper_duplicate_identifier_error_highlighting

Error

Empty return value for type-annotated function

EmptyReturnValueForTypeAnnotatedFunction

resharper_empty_return_value_for_type_annotated_function_highlighting

Warning

Exported entity uses a private entity

DeclarationVisibilityError

resharper_declaration_visibility_error_highlighting

Error

'Implicit any' inspection when NoImplicitAny is set

ImplicitAnyError

resharper_implicit_any_error_highlighting

Error

More specific signature follows less specific

MoreSpecificSignatureAfterLessSpecific

resharper_more_specific_signature_after_less_specific_highlighting

Warning

Overload is less specific than the main signature

LessSpecificOverloadThanMainSignature

resharper_less_specific_overload_than_main_signature_highlighting

Warning

Parameter-property value assigned inside constructor won't be assigned to class property

AssignedValueWontBeAssignedToCorrespondingField

resharper_assigned_value_wont_be_assigned_to_corresponding_field_highlighting

Warning

Suspicious 'instanceof' check

SuspiciousInstanceofCheck

resharper_suspicious_instanceof_check_highlighting

Warning

Suspicious 'this' usage in context of local function inside class member

SuspiciousThisUsage

resharper_suspicious_this_usage_highlighting

Warning

Suspicious 'typeof' check

SuspiciousTypeofCheck

resharper_suspicious_typeof_check_highlighting

Warning

Type parameter hides type parameter declared in outer scope

TypeParameterHidesTypeParamFromOuterScope

resharper_type_parameter_hides_type_param_from_outer_scope_highlighting

Warning

Use of possibly unassigned property in a static initializer

UseOfPossiblyUnassignedProperty

resharper_use_of_possibly_unassigned_property_highlighting

Warning

Use of undeclared variable

TsNotResolved

resharper_ts_not_resolved_highlighting

Error

Redundancies in Code (9 inspections)

Code inspections in this category look for redundancies and dead code, which affect code readability and style, and could be safely removed. Some code redundancies cannot be fixed automatically, and quick-fixes for them are performed in the interactive mode, requiring the user input. But the majority of the redundancies can be fixed without user interaction, using either fix in scope or code cleanup.

Inspection

ID

EditorConfig property

Default severity

Comparison of boolean with boolean value is equivalent to value or negated value

RedundantComparisonWithBoolean

resharper_redundant_comparison_with_boolean_highlighting

Warning

Double negation of boolean is redundant

DoubleNegationOfBoolean

resharper_double_negation_of_boolean_highlighting

Warning

Duplicate reference comment is redundant

DuplicateReferenceComment

resharper_duplicate_reference_comment_highlighting

Warning

Redundant parent type specification in extends/implements

RedundantParentTypeDeclaration

resharper_redundant_parent_type_declaration_highlighting

Warning

Redundant qualifier

RedundantQualifier

resharper_redundant_qualifier_highlighting

Warning

Reference comment creates cyclic dependency

CyclicReferenceComment

resharper_cyclic_reference_comment_highlighting

Disabled

Ternary operator may be replaced by it's condition

TernaryCanBeReplacedByItsCondition

resharper_ternary_can_be_replaced_by_its_condition_highlighting

Warning

Type cast is redundant: expression is always of provided type

RedundantTypeCast

resharper_redundant_type_cast_highlighting

Warning

Type cast is redundant: expression is of a structurally compatible type

RedundantTypeCastStructural

resharper_redundant_type_cast_structural_highlighting

Warning

Redundancies in Symbol Declarations (6 inspections)

This category includes code inspections, mostly with the warning severity level, which detect empty and unused symbol declarations.

Inspection

ID

EditorConfig property

Default severity

Parameter doesn't participate in the main signature

ParameterDoesntMakeAnySense

resharper_parameter_doesnt_make_any_sense_highlighting

Warning

Redundant empty constructor without parameters

RedundantEmptyConstructor

resharper_redundant_empty_constructor_highlighting

Warning

Same item is imported twice with different names

SameImportsWithDifferentName

resharper_same_imports_with_different_name_highlighting

Warning

Type guard definitely produces 'never' type for the variable

TypeGuardProducesNeverType

resharper_type_guard_produces_never_type_highlighting

Warning

Type guard doesn't affect variable's type in any way

TypeGuardDoesntAffectAnything

resharper_type_guard_doesnt_affect_anything_highlighting

Warning

Unused local import

UnusedLocalImport

resharper_unused_local_import_highlighting

Warning

Spelling issues (3 inspections)

These inspections detect typos in various contexts.

Inspection

ID

EditorConfig property

Default severity

Typo in comment

CommentTypo

resharper_comment_typo_highlighting

Suggestion

Typo in identifier

IdentifierTypo

resharper_identifier_typo_highlighting

Suggestion

Typo in string literal

StringLiteralTypo

resharper_string_literal_typo_highlighting

Suggestion

Last modified: 17 October 2018