TypeScript Strict Mode Migration: A Phased Adoption Checklist
typescriptstrict-modecompiler-optionsmigrationframework-typescriptbest-practices

TypeScript Strict Mode Migration: A Phased Adoption Checklist

TTypeScript.page Editorial Team
2026-11-28
6 min read

A phased checklist for enabling TypeScript strict mode, fixing migration errors, and rolling out safer compiler settings without breaking an existing app.

Enabling TypeScript strict mode in an established project does not have to be a one-day rewrite. This phased checklist shows how to assess the codebase, adopt strict compiler options in a manageable order, triage errors by cause, and use temporary escape hatches without allowing them to become permanent debt.

Overview

TypeScript strict mode is a group of compiler checks that makes the type system more precise. In a new project, enabling it early is usually straightforward. In a mature JavaScript-to-TypeScript migration or framework application, however, turning on every check at once can produce a large and confusing error list.

The safer approach is incremental adoption. Keep the application runnable, enable one meaningful group of checks at a time, fix errors by category, and prevent new code from lowering the project’s type-safety baseline. The exact set of options included by strict can expand as TypeScript evolves, so treat your installed TypeScript version and its compiler documentation as the final authority.

Before starting, create a branch and record a baseline:

npx tsc --noEmit
npm test
npm run build

These commands establish whether the project already has build or test failures unrelated to strict mode. If the repository uses a framework, run its own production build as well. For example, a Next.js, Vite, or Node project may apply additional checks outside the plain TypeScript compiler.

Checklist by scenario

Scenario 1: A new TypeScript project

  1. Start with strict: true in the project’s primary tsconfig.json.
  2. Confirm that the framework, test runner, and build tool actually read that configuration.
  3. Run the type check and production build before adding application features.
  4. Add explicit checks for generated code, scripts, tests, and configuration files if they use separate tsconfig files.
  5. Consider stricter options such as noUncheckedIndexedAccess separately. It is useful, but it is not simply a synonym for strict mode and can require broader API changes.

Scenario 2: An existing TypeScript application

  1. Find every TypeScript configuration used by the repository. Monorepos often have separate configs for an app, a package, tests, and build tooling.
  2. Run tsc --showConfig with the relevant configuration to inspect the effective settings rather than relying only on inherited files.
  3. Turn on strictNullChecks first if the project currently treats null and undefined too loosely. Fix data-loading, optional-prop, and lookup code before moving on.
  4. Enable noImplicitAny next. Replace inferred implicit types with useful domain types instead of adding any everywhere.
  5. Enable the remaining strict checks through strict: true, or turn them on individually if the team needs to isolate a particular class of errors.
  6. Keep each phase reviewable. A small pull request that fixes one error category is easier to test and revert than a single migration commit touching every file.

Scenario 3: A framework project with separate environments

  1. Check the framework’s recommended TypeScript configuration and preserve required settings such as JSX, module resolution, and framework-specific plugins.
  2. Separate application code from generated declarations and build output. Do not solve errors by including generated directories in the migration.
  3. Type shared boundaries first: route parameters, API responses, form values, environment variables, and component props.
  4. For React applications, pay particular attention to nullable data during loading states, event handler types, refs, and controlled form values. A typed form model should reflect what the UI can actually receive, not only the final submitted shape.
  5. For Node.js applications, check request bodies, environment variables, database results, and caught errors at runtime boundaries. TypeScript cannot validate untrusted input by itself; pair static types with runtime validation where needed.

Compiler-option comparison

OptionWhat it catchesMigration guidance
strictNullChecksUse of possibly null or undefined valuesStart with API responses, optional properties, array lookups, and framework loading states.
noImplicitAnyParameters and declarations whose type becomes implicit anyType public boundaries first, then callbacks and utility functions.
strictFunctionTypesUnsafe function parameter variance in many function typesReview callbacks, event handlers, and adapter functions where parameter types differ.
strictPropertyInitializationClass fields that may remain uninitializedInitialize fields, use definite assignment only when construction guarantees it, or redesign the class.
noImplicitThisUnclear or implicit this valuesPrefer functions that receive dependencies explicitly or annotate the intended receiver.
useUnknownInCatchVariablesAssumptions that every caught value is an ErrorNarrow with instanceof Error or a project-specific error guard before reading properties.
noImplicitOverrideSubclass methods that silently replace base methodsUse the override keyword where inheritance is intentional; confirm availability in the project’s TypeScript version.

What to double-check

Which configuration is authoritative? A framework command may use a different config from your editor or CI job. Make the type-check command explicit, for example tsc -p tsconfig.app.json --noEmit, and document it in the repository scripts.

Are errors real or configuration-related? “Cannot find name” errors can come from missing DOM, Node.js, test, or Web Worker libraries rather than faulty application types. Check lib, types, included files, and installed type packages before changing source code. See the guide to fixing TypeScript “Cannot Find Name” errors for a focused diagnostic path.

Are external boundaries typed honestly? An API response, parsed JSON value, form submission, or environment variable is not safe merely because it has a TypeScript annotation. Use narrowing or runtime validation at the boundary, then pass a reliable type into the rest of the application.

Are assertions hiding the migration? An occasional as assertion may be justified when a framework or library cannot express a known invariant. Prefer a type guard, a validated value, or a better model when the assertion crosses a trust boundary. The related discussion of satisfies, as const, and annotations can help preserve useful literal types without weakening checks.

Do tests and builds use the same assumptions? A passing editor does not prove that CI, a test runner, or a production bundler uses the same compiler settings. Run all relevant commands during each migration phase and inspect source maps if debugging becomes difficult.

Common mistakes

  • Enabling every option in one huge pull request. This makes it difficult to distinguish configuration problems from source-code problems. Use a sequence that the team can review and test.
  • Replacing every error with any. This reduces the error count without improving safety. Prefer unknown at uncertain boundaries and narrow it before use.
  • Using non-null assertions everywhere. The ! operator silences the compiler but does not make a value exist at runtime. Fix the control flow or represent the missing state explicitly.
  • Ignoring optional values in framework code. Data may be absent during the first render, route parameters may be incomplete, and refs may be null. Model those states rather than assuming the final state is present immediately.
  • Changing generated files by hand. Correct the generator, schema, or source configuration, then regenerate. Otherwise the next build will erase the fix.
  • Allowing suppressions without ownership. If @ts-ignore or a broad assertion is necessary temporarily, add a reason, an issue reference when appropriate, and a review date or removal condition.

When to revisit

Return to this checklist whenever the project changes its TypeScript version, framework, module configuration, test runner, or generated-code workflow. A compiler upgrade can expose new checks or alter inference, while a framework upgrade may introduce a new tsconfig or change which files are checked.

Revisit before a seasonal planning cycle or a major refactor. Review the remaining suppressions, search for new uses of any, and confirm that strict checking runs in local development and CI. If the team has finished the initial migration, consider adopting additional options individually, such as noUncheckedIndexedAccess or exactOptionalPropertyTypes, after measuring their effect on the codebase.

A practical final pass is:

  1. Run the project’s documented type-check command.
  2. Run unit, integration, and framework-specific build checks.
  3. Review new suppressions and assertions in the diff.
  4. Remove one temporary escape hatch while fixing the surrounding model or boundary.
  5. Record the next strict option or error category for the team to address.

Strict mode is most valuable when it becomes a maintained development habit rather than a one-time migration milestone. Treat the configuration as part of the application’s design, and update the checklist whenever the tools or boundaries change.

Related Topics

#typescript#strict-mode#compiler-options#migration#framework-typescript#best-practices
T

TypeScript.page Editorial Team

Technical Editor

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.