Registry
A

TypeScript/v5.6/arrow-function-condition-to-binary-expression

No description available

alexbit-codemod0 executions

  • Legacy
  • TypeScript
  • best-practices
Connect a repo
npx codemod TypeScript/v5.6/arrow-function-condition-to-binary-expression

Identify cases where an arrow function is mistakenly used instead of a comparison operator (e.g., x => 0 instead of x >= 0) and convert the arrow function expressions to proper comparison operations.

Before

ts
// Arrow Function Misused as a Comparison
const x = 5;
if ((x) => 0) {
 //some awesome code
}

After

ts
const x = 5;
if (x >= 0) {
  //some awesome code
}

Ready to evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.