Getting the specific type of a variable or expression can be done with typeof
or instanceof
. However, it's often more expressive to use the Remeda equivalent function
This rule takes no arguments.
The following patterns are considered warnings:
if (typeof a === "number") {
// ...
}
var isNotString = typeof b !== "string";
var isArray = a instanceof Array;
The following patterns are not considered warnings:
var areSameType = typeof a === typeof b;
var isCar = truck instanceof Car;
If you do not want to enforce using Remeda methods for type checks, you should not use this rule.