Query module BadTypeof

name
Useless type test
description
Comparing the result of a typeof test against a string other than ‘undefined’, ‘boolean’, ‘number’, ‘string’, ‘object’, ‘function’ or ‘symbol’ is useless, since this comparison can never succeed.
kind
problem
problem.severity
error
id
js/useless-type-test
tags
maintainability correctness language-features external/cwe/cwe-570 external/cwe/cwe-571
precision
very-high

Imports

javascript

Provides classes for working with JavaScript programs, as well as JSON, YAML and HTML.

Classes

EqOrSwitch

A comparison construct, that is, either an equality test or a switch case (which is implicitly compared to the switch statement’s discriminant).