Migrate a JavaScript project to TypeScript
8 steps · about 4 h 20 min · Intermediate
- Plan an incremental migration (guide, TypeScript documentation, 40 min)
Keep the project runnable while moving files and correcting assumptions in manageable steps.
- Include existing JavaScript (reference, TypeScript documentation, 25 min)
Bring current modules into one program before requiring every file to be TypeScript.
- Check JavaScript early (reference, TypeScript documentation, 30 min)
Surface useful type evidence and defects before renaming files or adding annotations.
- Separate checking from building (reference, TypeScript documentation, 25 min)
Adopt TypeScript analysis without unexpectedly replacing the project's current output pipeline.
- Raise strictness deliberately (reference, TypeScript documentation, 35 min)
Enable stronger guarantees with a visible error budget instead of masking the remaining work.
- Narrow uncertain values (guide, TypeScript documentation, 40 min)
Prove types through runtime checks rather than asserting that external data is already safe.
- Type an untyped dependency (guide, TypeScript documentation, 35 min)
Describe only the imported module surface the project actually relies on.
- Remove unsafe gaps (reference, TypeScript documentation, 30 min)
Find remaining implicit any values and replace them with specific types or explicit boundary validation.