TypeScript strict mode
Enable every strict compiler flag in one shot. Catch nullability bugs, implicit any, and uninitialized properties at build time instead of runtime.
Why strict?
"strict": true in tsconfig.json enables eight sub-flags: noImplicitAny, strictNullChecks, strictFunctionTypes, strictBindCallApply, strictPropertyInitialization, noImplicitThis, useUnknownInCatchVariables, and alwaysStrict. Together they eliminate entire classes of bugs that slip through loose TypeScript configs.
The config
{
"compilerOptions": {
"strict": true,
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"skipLibCheck": true
}
}What each flag catches
- noImplicitAny — variables and parameters must have explicit types
- strictNullChecks — null and undefined are not assignable to every type
- strictFunctionTypes — function parameter bivariance is checked correctly
- strictPropertyInitialization — class properties must be set in constructor or have definite assignment
Adopting incrementally
If your codebase is large, toggle strict on one directory at a time using project references or separate tsconfig files. Run npx tsc --noEmit after each change. Fix errors from the bottom of the list up — later errors are often cascading from earlier ones.
Meridian templates ship with strict enabled by default. New projects get the full safety net from day one.