On this page
The core idea
The tsconfig.json file controls how TypeScript checks your code. The strict flag enables a family of checks, including strictNullChecks, which treats null and undefined as separate types, and noImplicitAny, which reports places where a type cannot be inferred. Additional options such as noUncheckedIndexedAccess and exactOptionalPropertyTypes catch further classes of bugs. Each option is far easier to adopt on an empty project than on a large existing one.
A practical approach
Step 1
Set "strict": true in every new project.
Step 2
Consider "noUncheckedIndexedAccess": true, which makes array and record lookups possibly undefined and forces handling of missing entries.
Step 3
Enable "noFallthroughCasesInSwitch" and "noImplicitReturns" to catch control-flow mistakes.
Step 4
Run tsc --noEmit in continuous integration so type errors block merging, even if your bundler does not type-check.
Step 5
For an existing project, enable options one at a time, fix the errors per module and prevent new violations with CI.
Worked example
A project without strictNullChecks has a function findCourse(id) that returns undefined for unknown IDs, and callers read course.title directly. Enabling strict mode reports every one of those callers. Fixing them reveals an admin page that crashed for deleted courses, a bug that had been reported twice but never reproduced.
A mistake to avoid
Do not disable strict checks file by file with comments to get a build passing. That turns the configuration into a suggestion. If migration is large, track remaining files explicitly and reduce the list over time.
Try it yourself
Create a new TypeScript project with strict mode and noUncheckedIndexedAccess enabled. Write a small function that reads from an array by index and handle the possibly undefined result correctly.
Your implementation checklist
- strict is enabled
- Indexed access is checked for missing values
- Control-flow checks are enabled
- Type checking runs in CI
- Existing projects migrate option by option without blanket suppressions
Share or cite this guide
Innovate with Ajay Editorial (2026-10-07). Configure tsconfig Strictly from the Start of a Project. https://innovatewithajay.com/blogs/configure-tsconfig-strictly
