Types are documentation that can't rot
Comments drift, wikis gather dust, but a type error fires the day reality changes. TypeScript changed how I document.
By Nzubechukwu Cyprian · Pharmacy student at UNN, full-stack developer
I used to document my code in comments and wikis. Then I watched both rot — the code changed, the docs didn't, and the documentation became actively misleading. Types fixed what neither could: they can't disagree with the code, because they are the code.
What types do that comments can't
They update under force. Change a field's shape and every place that depends on it turns red until it's fixed. A comment just quietly lies.
They document at the point of use. Autocomplete in six months is the documentation, delivered exactly where the next reader needs it.
They encode decisions. A status: "building" | "active" | "maintaining" type doesn't just describe data — it announces the legal states of my product's world and forbids everything else. That's design, enforced.
Where comments still win
Types describe shape; comments explain intent. Why a limit exists, what a workaround protects against, why the obvious alternative was rejected — none of that fits in a type. I keep both, with a clean division: types for structure, comments for reasoning.
The compounding payoff
In a content-driven site like this one, types are the quality control: a blog post missing a field fails the build instead of failing readers. The compiler became the most diligent reviewer I've ever had — it never gets tired, and it never gets polite.
Keep reading
- Software engineering
Naming things is the whole job, sometimes
Most codebases don't have a naming problem — they have a thinking problem that shows up in their identifiers.
- Software engineering
Your README is your first interview
Before anyone judges your code, they judge your README. What a good one actually contains, from someone who reads a lot of them.
- Software engineering
The bug that taught me to read error messages properly
A three-line error sat in my logs for a week. It told me exactly what was wrong. I just never read past the first line.