All articles

Where TypeScript actually earns its keep

TypeScript gets sold as "fewer bugs." Honestly? That's not where it earned its keep for me.

The real wins were somewhere else:

1. Shared types between frontend and backend.

One source of truth for what an API returns. The frontend stops guessing, stops defensively checking fields that "might" exist. Change the shape on the server and the client lights up red before anything ships. That single thing removes a whole category of "works on my machine."

2. Refactors you're not afraid of.

Rename a field, change a function's signature, restructure a module, and the compiler hands you the exact list of everything you just broke. Big changes stop being scary bets and become mechanical. You refactor more because it costs less.

3. The types are the documentation that can't go stale.

Comments lie. READMEs rot. Types are checked on every build, so they're always true. New devs read the signatures and know how to use the code, no archaeology required.

Honest limits

  • A throwaway script doesn't need it. Match the tool to the stakes.
  • You can over-engineer types into a puzzle nobody can read. If a type needs a comment to explain it, simplify.

Fewer bugs is a nice side effect. Confidence to change things is the real product.

TS everywhere, or plain JS for the small stuff — where do you draw the line?