DEV Community

i-am-killvish
i-am-killvish

Posted on

I built a CLI that fixes TypeScript errors automatically

Fixing TypeScript errors like:

“Expected 1 arguments, but got 0 (TS2554)”

gets repetitive really fast.

So I built a small CLI tool called fixmyfile that automatically fixes some common TypeScript errors using the compiler API and AST transformations.

⚡ Demo

Fixing a TypeScript error automatically:

🧠 What it does

The tool:

scans a .ts file
detects TypeScript compiler errors
applies automatic fixes
repeats until no more changes are possible

⚡ Example

❌ Before
function greet(name: string) {
console.log(name);
}

greet(); // missing args
✅ After
greet("text");

🖥 Try it

You can run it directly using:

npx fixmyfile yourfile.ts

🧩 Currently supports

Missing function arguments (TS2554)
Basic type mismatch fixes (TS2322)
Undefined references (TS2304)

⚠️ Note

This is still experimental and focuses on common, repetitive fixes.
Always review the output before committing changes.

💬 Feedback

Would love to know:

Did it work on your code?
What errors should it support next?
Where did it break?

👉 https://github.com/i-am-killvish/fixmyfile

🚀 Why I built this

I kept running into the same TypeScript errors during development and realized many of them are predictable enough to automate.

This is an early attempt at making that process faster.

If this sounds useful, give it a try and let me know what you think 🙂

Top comments (0)