Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The biggest use of types, for me, is being able to read code more easily. Right now, I'm elbow deep in some old PHP code, and it is painful trying to trace the flow of data through a system.

What is $item? What does it contain? I have no idea, and to find out, I have to dig through at least five files (so far) to figure out how it's put together.



nothing is better than vanilla javascript "props" object with no documentation, several non-consistent key calls and spaghetti code.


and some `...rest` spread that could be anything anytime in the future.


Came here to say basically the same thing. Reducing runtime errors is not the only benefit of types, or sometimes investing in complex types.

Ease of reading, code navigation, refactoring, producing documentation, code generation, etc... there are myriad benefits.

As you would expect from something that fundamentally helps computers (and humans) understand and verify the intent and structure of code better.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: