TypeScript doesn't stop bugs. It just moves them earlier. For a long time I thought those were th...TypeScript doesn't stop bugs. It just moves them earlier. For a long time I thought those were th...
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started
TypeScript doesn't stop bugs. It just moves them earlier. For a long time I thought those were the same thing.
They're not.
A few months ago I inherited a NestJS service with pretty good type coverage. DTOs everywhere, strict mode on, the works. It still shipped a bug where a field marked as required was actually optional in the database. TypeScript was happy. Postgres was happy. The two of them just didn't agree with each other, and nothing forced that disagreement into the open until a null value hit a .toUpperCase() call in production.
The types weren't wrong exactly. They were describing what I believed, not what was actually true. A type system is good at keeping you consistent with your own assumptions. It has no idea if those assumptions are right.
Here's what changed for me. I stopped treating a green TypeScript build as proof something was correct. Now I treat it as proof it's internally consistent, which is a smaller claim. I added a real check at the point where data comes in from the database, instead of trusting the type all the way through.
I still think TypeScript is worth using. I just don't think it does what a lot of us assume it does.
Where has type safety given you false confidence instead of real confidence?🙌
Post image
Back to feed
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started