Day 5 of 60
·
Static analysis & type-time
Static type checking
Whole categories of bug, null deref, undefined-is-not-a-function, wrong shape, disappear the moment the compiler knows what you mean. Strict types are how you stop reading the same Sentry report twice.
ProblemRuntime errors that the compiler could have caught.
How it works
Strict types, TypeScript strict mode, mypy strict, C# nullable, Rust's borrow checker, turn whole categories of runtime errors into compile-time errors. The check runs on every keystroke in modern editors.
Try it
A self-contained mini-lab. Click through to see the technique catch a real bug.
Click Run tsc to type-check the file.
What it catches
Null derefs, type confusion, signature mismatches, refactor-induced breakage. Catches 15–25% of all defects before they reach version control.
Tools
TypeScript · OSS mypy / pyright · OSS Rust / Go · OSS
Verdict by project size
Small
Must
Medium
Must
Large
Must
Extra-large
Must
Cost
| Project size | Setup | Maint / mo | Tool / mo | CI / run |
|---|---|---|---|---|
| Small <10k LOC | 4h | 1h | $0 | +0.5m |
| Medium 10–100k LOC | 2d | 4h | $0 | +1m |
| Large 100k–1M LOC | 5d | 15h | $0 | +3m |
| Extra-large >1M LOC | 15d | 50h | $0 | +8m |
Setup = engineer-days to first useful run ·
Maint = engineer-hours / month at steady state ·
Tool = out-of-pocket $ / month ·
CI = minutes added (or saved) per pipeline run
Lifecycle & ownership
When in lifecycle
Code Build
Pre-commit / IDE · Runs locally before code leaves the developer's machine.
Who owns it
Developer
Authoring + the inner loop
Collaborates with: Security / AppSec
Reference implementations
-
TypeScript Node Starter
Strict TypeScript project scaffold with compiler-driven validation in the inner loop.
-
TypeScript compiler tests
Large corpus of type-system fixtures that show compile-time regression testing at scale.
-
DefinitelyTyped type tests
Community-scale example of type definitions validated through automated type checks.
Quick check
Static type checking primarily catches which class of defect?
One question. Pick the best answer. Your streak is saved locally on this device.
Save the lesson
Download SVG ↓Screenshot for a 1:1, drop it in Slack, or download the SVG.