Migrate JavaScript Files to TypeScript
Converts .js files to .ts one at a time and confirms the compiler still accepts them.
Anyone moving an older or AI-scaffolded JavaScript project to TypeScript without doing the whole codebase in one sitting.
The problem
Converting a file to TypeScript usually surfaces type errors that were hidden before. Doing this file by file and rerunning the compiler after each one to see what broke is repetitive and easy to lose track of across a large project.
1. Work list
The command that lists every item. No AI involved.
find ./src -name '*.js' -not -path '*/node_modules/*'2. Unit of work
One item is one .js file to be renamed to .ts and made to type-check.
3. The check
The checker confirms the .js file no longer exists, the .ts file does, and runs npx tsc --noEmit scoped to that path. Exit code 0 if the .ts file exists and reports zero errors. Exit code 1 if the .js file still exists or the .ts file has errors, printing them back to the AI.
4. Stopping rule
Each file gets up to 3 attempts before quarantine, and the loop ends when the work list of .js files is empty.
What this cannot catch
Passing the compiler does not mean the new types are meaningful. A lazy conversion that types everything as unknown can still pass.
Build it
Install justloopit, then describe this task in your AI coding tool. It will ask about your project, then write the checker, the runner, and the spec.