Back to list
TypeScript エラーの自動修復を行う CLI を作成しました
I built a CLI that fixes TypeScript errors automatically
Translated: 2026/4/25 2:01:02
Japanese Translation
「期待されていた引数が 0 個でしたが、0 個の引数を受け取ったわけではありません (TS2554)」といった TypeScript エラーを直すのは非常に時間がかかります。そこで、コンパイラ API と AST 変換を使用して、一般的な TypeScript エラーを自動的に修正する小型の CLI ツール「fixmyfile」を作成しました。
自動での TypeScript エラー修正:
ツール:
- 変数 `.ts` ファイルのスキャン
- ❌ 修正前
- `greet(); // 引数が不足している`
直接実行するには次のようにします:
```bash
npx fixmyfile yourfile.ts
```
- 不足している関数引数 (TS2554)
これはまだ実験的な段階で、一般的な繰り返しある修正に焦点を当てています。
効果があったかどうかに興味があります:
👉 https://github.com/i-am-killvish/fixmyfile
開発中に同じ TypeScript エラーを遭遇し、多くのものが予測可能なもので自動化可能なことに気づきました。
このプロセスをより高速化するための初期尝试です。
有用だと思われる場合は、ぜひお試しください。感想をお知らせください 🙂
Original Content
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.
Fixing a TypeScript error automatically:
The tool:
scans a .ts file
❌ Before
greet(); // missing args
You can run it directly using:
npx fixmyfile yourfile.ts
Missing function arguments (TS2554)
This is still experimental and focuses on common, repetitive fixes.
Would love to know:
Did it work on your code?
👉 https://github.com/i-am-killvish/fixmyfile
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 🙂