TypeScript · Lesson 77 of 120
Strict Mode
The safety switches.
Strict is a switch for a group of checks. Without it, TypeScript lets many risky things through. Every example in this course has strict on.

- A group of checks
- Risky without it
- Always on here
No implicit any
This function forgot its parameter types. With strict on, TypeScript refuses to guess any. Run it. Both parameters are reported.
app.tstypescript
function addVat(price, rate) {
return price * (1 + rate);
}Output
app.ts line 1: Parameter 'price' implicitly has an 'any' type. app.ts line 1: Parameter 'rate' implicitly has an 'any' type.
What strict turns on
No implicit any requires types where they can't be inferred. Strict null checks makes you handle null and undefined. Strict function types checks callbacks properly. And unknown in catch makes caught errors unknown.
| Check | Catches |
|---|---|
| noImplicitAny | missing types |
| strictNullChecks | null and undefined |
| strictFunctionTypes | wrong callbacks |
| useUnknownInCatchVariables | unchecked errors |
Summary
Strict turns on the most valuable checks. Keep it on, always. Next, npm packages and their types.
Key takeaways- noImplicitAny
- strictNullChecks
- Always on
Next up: npm Packages and @types — typed libraries