Re:38% of bugs at Airbnb could have been prevented by using ...
by z3t4 on Monday February 11, 2019 @07:26AM
(#19133891)
For code written in JavaScript you check the source code to see what arguments it takes and what it returns. If it's not written in JavaScript, for example a Browser API's or NodeJS built in module, you read the documentation and use console.log's. Then you rely of good naming, for example (nrA, nrB) => sum vs (a:Number, b:Number) => c:Number where the one without static types is more clear of what the function does and what it returns.
[ Parent
| on HN ]
Re:38% of bugs at Airbnb could have been prevented by using ...
by untog on Monday February 11, 2019 @10:05AM
(#19134916)
Having to search through source for the argument types of a function is usually an example given in favour of strong typing, not against it.
Re:38% of bugs at Airbnb could have been prevented by using ...
by z3t4 on Monday February 11, 2019 @10:31AM
(#19135105)
There are not many reasons to read the code of your dependencies, you will learn a lot doing so. One issue when you work with the compiled code is that the type annotations have been removed, and that type annotations leads to more terse code as it would otherwise become too verbose eg. number:number tends to become n:number and when the type is removed it just becomes n, so you kinda become dependent of your tooling and can't easily just stop using it in favor of something better.
Re:38% of bugs at Airbnb could have been prevented by using ...
by DCoder on Monday February 11, 2019 @12:59PM
(#19136520)
Compiled code doesn't have to be unreadable.
Languages like C and C++ made it readable with debug symbols.
The web stack does the same with source maps. The TypeScript compiler also offers to emit .d.ts files with type information for reuse in other projects.