no-unsafe-unary-minus
Configuration
rslint.config.ts
Rule Details
Disallow unary negation of a value that is not a number or bigint.
Applying the unary minus operator (-) to a value that is not a number or bigint type is a likely mistake. JavaScript will coerce the value to a number, often resulting in NaN. This rule ensures the operand of unary negation is always number or bigint.
Examples of incorrect code for this rule:
Examples of correct code for this rule: