Migrating a legacy codebase to TypeScript strict mode

Strict mode is the difference between TypeScript that catches bugs and TypeScript that decorates JavaScript. Getting there in a legacy codebase requires patience.
Turn on flags one at a time
Start with noImplicitAny, then strictNullChecks, then the rest. Each flag is its own migration project.
Quarantine the worst files
Use ts-expect-error sparingly and with comments explaining the debt. Track them in a single dashboard.
Lint the loopholes
Forbid any, as casts, and non-null assertions in new code via ESLint. The codebase will stop regressing while you fix the old debt.



