Enable all strict flags in tsconfig.json (strict: true). Without strict mode, TypeScript allows null access, implicit any, and unchecked function calls that will crash at runtime.
Why This Matters
Without strict mode, TypeScript permits operations that are guaranteed to fail at runtime: accessing properties on null, calling functions with wrong argument counts, and treating values as typed when they're actually any. Strict mode catches these at compile time. Enabling it on a mature codebase typically surfaces 50-200 real bugs that were silently waiting to crash in production.
TypeScript's default configuration is intentionally lenient to make adoption easier. But the lenient defaults allow categories of bugs that strict mode catches at compile time:
strictNullChecks: false — allows null and undefined to be assigned to any type. You can call .toString() on a value that is null at runtime and TypeScript won't warn you.
noImplicitAny: false — function parameters without type annotations silently become any, disabling all type checking.
strictFunctionTypes: false — allows contravariant function assignment, enabling callbacks with wrong parameter types.
Enabling strict: true is a single flag that turns on all strict checks. It is the difference between TypeScript being a documentation tool and TypeScript being a safety net.
The rule
Set "strict": true in your tsconfig.jsoncompilerOptions. This enables: strictNullChecks, noImplicitAny, strictFunctionTypes, strictBindCallApply, strictPropertyInitialization, noImplicitThis, alwaysStrict, and useUnknownInCatchVariables.
// These compile without errors — but crash at runtimefunction greet(name) { // name is implicitly any — no type checking return name.toUpperCase(); // crashes if name is null}const user = getUser(); // could return nullconsole.log(user.email); // null access — no warning
// TypeScript now catches these at compile timefunction greet(name: string) { return name.toUpperCase(); // safe — name is guaranteed to be a string}const user = getUser(); // returns User | nullif (user) { console.log(user.email); // safe — null check narrows the type}
How to detect
Check your tsconfig.json:
grep -n "strict" tsconfig.json
If "strict" is missing or set to false, the project is running without strict mode.
Remediation
Set "strict": true in tsconfig.json
Run npx tsc --noEmit to see all new errors
Fix errors in priority order: null checks first, then implicit any, then function types
For large codebases, enable individual flags one at a time: start with strictNullChecks, then noImplicitAny
Use // @ts-expect-error sparingly for temporary suppressions with a linked ticket to fix later