ReSharper 2020.1 Help

Code Inspections in TypeScript

In TypeScript, ReSharper 2020.1 provides two kinds of code inspections: 141 inspections that detect errors such as broken syntax, unresolved symbols, compiler errors, and so on (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.

Common Practices and Code Improvements (4 inspections)

This category groups inspections that hunt for medium severity issues that mainly affect code readability.
InspectionIDEditorConfig propertyDefault severity
Constructor of an abstract class can be made protectedAbstractClassConstructorCanBeMadeProtectedresharper_abstract_class_constructor_can_be_made_protected_highlightingHint
Introducing variable will allow to apply type guardIntroduceVariableToApplyGuardresharper_introduce_variable_to_apply_guard_highlightingHint
Private class field can be made readonlyPrivateVariableCanBeMadeReadonlyresharper_private_variable_can_be_made_readonly_highlightingHint
String literal usage allows creating specialized overloadCreateSpecializedOverloadresharper_create_specialized_overload_highlightingHint

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.
InspectionIDEditorConfig propertyDefault severity
AMD module may be converted to external moduleAmdExternalModuleresharper_amd_external_module_highlightingSuggestion
Class emulation may be converted to classClassresharper_class_highlightingSuggestion
CommonJs module may be converted to external moduleCommonJsExternalModuleresharper_common_js_external_module_highlightingSuggestion
Function expression may be converted to lambda expressionLambdaresharper_lambda_highlightingSuggestion
Immediately-invoked function expression may be converted to internal moduleInternalModuleresharper_internal_module_highlightingSuggestion
Invocation of parent class may be converted to super callSuperCallresharper_super_call_highlightingSuggestion
Member assigned by a function may be converted to function memberMethodSafeThisresharper_method_safe_this_highlightingSuggestion
Possible overloads may be inferred by function bodyOverloadSignatureInferringresharper_overload_signature_inferring_highlightingHint
Use 'as' operator instead of type assertionUseAsInsteadOfTypeCastresharper_use_as_instead_of_type_cast_highlightingHint

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.
InspectionIDEditorConfig propertyDefault severity
Cannot resolve, probably symbol is located in inaccessible moduleTsResolvedFromInaccessibleModuleresharper_ts_resolved_from_inaccessible_module_highlightingError
Check 'amd-dependency' the same way as require() argumentAmdDependencyPathProblemresharper_amd_dependency_path_problem_highlightingDisabled
Duplicate identifierDuplicateIdentifierErrorresharper_duplicate_identifier_error_highlightingError
Empty return value for type-annotated functionEmptyReturnValueForTypeAnnotatedFunctionresharper_empty_return_value_for_type_annotated_function_highlightingWarning
Exported entity uses a private entityDeclarationVisibilityErrorresharper_declaration_visibility_error_highlightingError
'Implicit any' inspection when NoImplicitAny is setImplicitAnyErrorresharper_implicit_any_error_highlightingError
More specific signature follows less specificMoreSpecificSignatureAfterLessSpecificresharper_more_specific_signature_after_less_specific_highlightingWarning
Overload is less specific than the main signatureLessSpecificOverloadThanMainSignatureresharper_less_specific_overload_than_main_signature_highlightingWarning
Parameter-property value assigned inside constructor won't be assigned to class propertyAssignedValueWontBeAssignedToCorrespondingFieldresharper_assigned_value_wont_be_assigned_to_corresponding_field_highlightingWarning
Suspicious 'instanceof' checkSuspiciousInstanceofCheckresharper_suspicious_instanceof_check_highlightingWarning
Suspicious 'this' usage in context of local function inside class memberSuspiciousThisUsageresharper_suspicious_this_usage_highlightingWarning
Suspicious 'typeof' checkSuspiciousTypeofCheckresharper_suspicious_typeof_check_highlightingWarning
Type parameter hides type parameter declared in outer scopeTypeParameterHidesTypeParamFromOuterScoperesharper_type_parameter_hides_type_param_from_outer_scope_highlightingWarning
Use of possibly unassigned property in a static initializerUseOfPossiblyUnassignedPropertyresharper_use_of_possibly_unassigned_property_highlightingWarning
Use of undeclared variableTsNotResolvedresharper_ts_not_resolved_highlightingError

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.
InspectionIDEditorConfig propertyDefault severity
Comparison of boolean with boolean value is equivalent to value or negated valueRedundantComparisonWithBooleanresharper_redundant_comparison_with_boolean_highlightingWarning
Double negation of boolean is redundantDoubleNegationOfBooleanresharper_double_negation_of_boolean_highlightingWarning
Duplicate reference comment is redundantDuplicateReferenceCommentresharper_duplicate_reference_comment_highlightingWarning
Redundant parent type specification in extends/implementsRedundantParentTypeDeclarationresharper_redundant_parent_type_declaration_highlightingWarning
Redundant qualifierRedundantQualifierresharper_redundant_qualifier_highlightingWarning
Reference comment creates cyclic dependencyCyclicReferenceCommentresharper_cyclic_reference_comment_highlightingDisabled
Ternary operator may be replaced by it's conditionTernaryCanBeReplacedByItsConditionresharper_ternary_can_be_replaced_by_its_condition_highlightingWarning
Type cast is redundant: expression is always of provided typeRedundantTypeCastresharper_redundant_type_cast_highlightingWarning
Type cast is redundant: expression is of a structurally compatible typeRedundantTypeCastStructuralresharper_redundant_type_cast_structural_highlightingWarning

Redundancies in Symbol Declarations (6 inspections)

This category includes code inspections, mostly with the warning severity level, which detect empty and unused symbol declarations.
InspectionIDEditorConfig propertyDefault severity
Parameter doesn't participate in the main signatureParameterDoesntMakeAnySenseresharper_parameter_doesnt_make_any_sense_highlightingWarning
Redundant empty constructor without parametersRedundantEmptyConstructorresharper_redundant_empty_constructor_highlightingWarning
Same item is imported twice with different namesSameImportsWithDifferentNameresharper_same_imports_with_different_name_highlightingWarning
Type guard definitely produces 'never' type for the variableTypeGuardProducesNeverTyperesharper_type_guard_produces_never_type_highlightingWarning
Type guard doesn't affect variable's type in any wayTypeGuardDoesntAffectAnythingresharper_type_guard_doesnt_affect_anything_highlightingWarning
Unused local importUnusedLocalImportresharper_unused_local_import_highlightingWarning

Spelling issues (3 inspections)

These inspections detect typos in various contexts.
InspectionIDEditorConfig propertyDefault severity
Typo in commentCommentTyporesharper_comment_typo_highlightingSuggestion
Typo in identifierIdentifierTyporesharper_identifier_typo_highlightingSuggestion
Typo in string literalStringLiteralTyporesharper_string_literal_typo_highlightingSuggestion

Syntax 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] | Syntax Style page of ReSharper options (Alt+R O). You can also fix issues that these inspection detect using code cleanup.
InspectionIDEditorConfig propertyDefault severity
Element has implicit 'any' typeImplicitAnyTypeWarningresharper_implicit_any_type_warning_highlightingWarning
Non-compliant path style inside 'require'WrongRequireRelativePathresharper_wrong_require_relative_path_highlightingHint
Non-compliant 'public' modifier or its absenceWrongPublicModifierSpecificationresharper_wrong_public_modifier_specification_highlightingHint
Type of variable may be specified explicitlySpecifyVariableTypeExplicitlyresharper_specify_variable_type_explicitly_highlightingHint
Type specification is redundant, because variable type is contextually determined from the type of assigned valueRedundantVariableTypeSpecificationresharper_redundant_variable_type_specification_highlightingHint
Last modified: 15 July 2020