Skip to content
Esc
↑↓navigate↵open⌘Jpreview
Start
On this page

Migrate JavaScript to TypeScript

Convert a JS module or package to TypeScript while preserving runtime behavior and fixing type errors in small passes.

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 Code CLI Playbook, CLI reference, and configuration reference 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.

Last updated on

Was this helpful?

Send Feedback

Help us improve this documentation page. Your feedback is valuable.

We'll only contact you if we need clarification