0Pricing
TypeScript Academy · Lesson

Starting the Migration: allowJs and checkJs

Enable TypeScript checking in a JavaScript project.

The Migration Challenge

Migrating a large JavaScript codebase to TypeScript all at once is risky. The incremental path: enable TypeScript gradually, file by file, while keeping the project functional.

# Key compiler flags for gradual migration:
# allowJs — allow .js files in the compilation
# checkJs — type-check .js files with JSDoc types

Step 1: Install TypeScript

Add TypeScript to the project and create a minimal tsconfig without strict mode initially.

npm install --save-dev typescript
npx tsc --init
# Edit tsconfig.json to set allowJs: true

All lessons in this course

  1. Starting the Migration: allowJs and checkJs
  2. JSDoc Type Annotations as a Bridge
  3. File-by-File Conversion Strategy
  4. Dealing with Untyped Third-Party Libraries
← Back to TypeScript Academy