42 ms·
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
by pavel_lishin 2y ago
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.
- green_dee 2y agonothing is better than vanilla javascript "props" object with no documentation, several non-consistent key calls and spaghetti code.
- dimitrisnl 2y agoand some `...rest` spread that could be anything anytime in the future.
- spankalee 2y agoCame 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.