$ recombobulate _
home / tips / convert-javascript-to-typescript-incrementally-with-claude
0

Convert JavaScript to TypeScript Incrementally with Claude

bagwaa @bagwaa · Mar 26, 2026 · Workflows
convert-javascript-to-typescript-incrementally-with-claude

Migrating a JavaScript project to TypeScript doesn't have to be a big bang rewrite. Claude can convert files one at a time while keeping everything working.

Start by asking Claude to set up the TypeScript config for incremental adoption:

Set up TypeScript in this JavaScript project for incremental migration.
Configure tsconfig.json with allowJs: true and strict: false.
Add a build script that compiles both .js and .ts files.
Don't convert any files yet — just make the infrastructure ready.

Then convert files starting from the leaves of your dependency tree:

Convert src/utils/formatters.js to TypeScript.
Add proper types for all function parameters and return values.
Replace any JSDoc type annotations with TypeScript syntax.
Make sure all files that import from this module still work.
Run the existing tests to verify nothing broke.

For bulk conversion, work directory by directory:

Convert all files in src/utils/ from .js to .ts.
Add types based on the actual usage patterns in the codebase.
Create a src/types/ directory for any shared interfaces.
Keep it practical — use explicit types for public APIs and let
TypeScript infer the rest.

Once everything is converted, ask Claude to tighten the config:

Enable strict mode in tsconfig.json and fix every resulting type error.
Don't use 'any' as an escape hatch — find the correct types.

Incremental TypeScript migration keeps your app shipping while the types catch up — Claude handles the tedious file-by-file conversion.

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Scan Pending Changes for Security Issues with /security-review

The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.

bagwaa @bagwaa · 1 hour ago
0
Run Setup Scripts on Every Session with the SessionStart Hook

The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.

bagwaa @bagwaa · 1 hour ago
0
Write Property-Based Tests with fast-check and Claude

Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.

bagwaa @bagwaa · 2 hours ago