Menu

1 / 2

I built a CLI that fixes TypeScript errors automatically

DEV Community·i-am-killvish·6 months ago
#9OqyGUPo
Reading 0:00
15s threshold

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…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.