TS2845

This condition will always return 'false'.

Broken Code ❌

if (input === NaN) {
  // some logic
}

This error occurs because comparing a value directly to NaN using === will always return false. In JavaScript and TypeScript, NaN is not equal to itself.

Fixed Code ✔️

To check if a value is NaN, use Number.isNaN() instead:

if (Number.isNaN(input)) {
  // some logic
}

The Number.isNaN() method properly checks if the input is NaN, avoiding the issue with direct equality comparison.