Convert a JS module or package to TypeScript while preserving runtime behavior and fixing type errors in small passes.
Move gradually with compiler feedback
Modernization Build and change Implementation Code
autohand -p "Migrate this JavaScript module to TypeScript with minimal behavior changes"
Typed code, updated configs, and a list of follow-up typing gaps.
Migrate JavaScript to TypeScript with Autohand Code is a modernization workflow that moves JavaScript modules to TypeScript in small compiler-guided passes while preserving runtime behavior. ### At a glance | Question | Answer | | --- | --- | | Best for | incremental typing of modules, packages, utilities, and app surfaces with known behavior | | Primary inputs | First file, package, or boundary to migrate; Runtime behavior that must remain unchanged; Compiler strictness and follow-up tolerance | | Autohand Code returns | Typed code, updated configs, and a list of follow-up typing gaps. | | Avoid when | the team wants to redesign the module API at the same time | ### How Autohand Code handles this workflow 1. Inspects imports, exports, callers, config, and test coverage. 2. Renames or splits files only where the project pattern supports it. 3. Fixes compiler errors without broad config churn. 4. Leaves intentional type gaps visible when a full cleanup would distract from migration. ### Best inputs - First file, package, or boundary to migrate - Runtime behavior that must remain unchanged - Compiler strictness and follow-up tolerance ### Strong prompt autohand -p "Migrate this JavaScript module to TypeScript with minimal behavior changes" ### Autohand Code CLI options - Run `autohand -p "Migrate this JavaScript module to TypeScript with minimal behavior changes"` for one boundary. - Use `autohand --auto-mode "Migrate these JS modules one at a time and run typecheck after each pass" --max-iterations 12` for staged migration work. - When `slash_goal` is enabled, queue later modules with `/goal queue <objective>` so follow-up work stays separate from the current patch. ### Review before accepting Review the diff for preserved runtime behavior, focused config changes, no casual any casts, and passing type or test commands. ### Source and validation signals Autohand AI maintains this workflow as first-party product guidance for Autohand Code. Use the [Autohand CLI Playbook](https://github.com/autohandai/code-cli/blob/main/docs/AUTOHAND_PLAYBOOK.md), [CLI reference](/docs/working-with-autohand-code/cli-reference.html), and [configuration reference](https://github.com/autohandai/code-cli/blob/main/docs/config-reference.md) when choosing between interactive mode, command mode, auto-mode, feature-enabled /goal, /settings, skills, MCP, and permission settings. The related resources below link to product docs and tutorials for the workflow, and the final answer should name repository-specific files, commands, outputs, or docs that a reviewer can verify. ### Frequently asked questions ### What is Migrate JavaScript to TypeScript with Autohand Code? Migrate JavaScript to TypeScript with Autohand Code is a modernization workflow that moves JavaScript modules to TypeScript in small compiler-guided passes while preserving runtime behavior. ### When should a team use Migrate JavaScript to TypeScript? Use it when a gradual migration is safer than a rewrite and compiler feedback can guide the work. ### What evidence should reviewers check for Migrate JavaScript to TypeScript? Review the diff for preserved runtime behavior, focused config changes, no casual any casts, and passing type or test commands.
Tutorial Migrate JavaScript to TypeScript Move a module to TypeScript in small, compiler-guided passes. /docs/tutorials/migrate-js-to-typescript.html Guide Node.js/JavaScript Modernization with Autohand Code Modernize JavaScript codebases while preserving runtime behavior. /docs/guides/nodejs-modernization.html Guide Code Modernization Guide Plan modernization around safe slices, tests, rollout scope, and review evidence. /docs/guides/code-modernization.html