News for hackers. Stuff that matters.
Re:38% of bugs at Airbnb could have been prevented by using ... by shhehebehdh on Sunday February 10, 2019 @10:42PM (#19131890)
Although typing bugs are often the simpler type of bugs to fix.
Re:38% of bugs at Airbnb could have been prevented by using ... by ajxs on Monday February 11, 2019 @12:35AM (#19132303)
The bigger problem is that "Simple fix" !== "Simple ramifications". Runtime issues caused by missing very simple typing bugs can bring down critical systems in Node. I worked at a company where a payment batching system built ( not by me ) with a MongoDB database failed to work correctly because the aggregation query was checking a field was `null`, without checking if it was there in the first place... No one even noticed for several weeks until someone finally investigated the low volumes. That's a very kind example too, just because they're simple to debug when they pop up doesn't mean that they won't cause massive destruction in prod.
Re:38% of bugs at Airbnb could have been prevented by using ... by smt88 on Sunday February 10, 2019 @11:10PM (#19132001)
This is only true if the bug is caught by the runtime checker. Lots of type bugs aren't, especially in languages with type coercion.
Re:38% of bugs at Airbnb could have been prevented by using ... by Operyl on Sunday February 10, 2019 @10:58PM (#19131953)
Until they’re not. I’ve had some codebases where it took 3-4 hours to figure out that some really bizarre issue was really just a type bug. And I don’t consider myself a terrible debugger.
Re:38% of bugs at Airbnb could have been prevented by using ... by shhehebehdh on Tuesday February 12, 2019 @06:12PM (#19148668)
Obviously. Any distribution will have some exemplars toward the tail.
Re:38% of bugs at Airbnb could have been prevented by using ... by root_axis on Monday February 11, 2019 @12:53AM (#19132362)
I don't think that's really true as a general rule. Passing a variable of an unexpected type or nullable could have completely unpredictable behavior depending on what assumptions the code makes about the incoming parameter. It could have no effect or a catastrophic one, there's really no way to know without reading actual code.
Re:38% of bugs at Airbnb could have been prevented by using ... by jondubois on Monday February 11, 2019 @04:32AM (#19133119)
So true and simpler to detect too.

The kinds of bugs which TypeScript prevents are those which could have been caught by the simplest of integration tests using the simplest inputs.

Every time I rename or change something in TypeScript, I have to change it in so many different places. In JavaScript, changes where much more localized.

Re:38% of bugs at Airbnb could have been prevented by using ... by baroffoos on Monday February 11, 2019 @01:04AM (#19132405)
Not at all. Typing bugs often leave code looking perfectly fine until you discover that one of the variables you expected to be y was actually x. And the only way to find out is to just print out everything
Re:38% of bugs at Airbnb could have been prevented by using ... by jondubois on Monday February 11, 2019 @04:39AM (#19133159)
Can happen with TypeScript too. There is no runtime type checking so if you parsed a JSON object and cast some unknown property `const result = someRemoteObject.someUnknownPropertyWhichIsAString as number`, it doesn't guarantee that the result is actually a number. You still need to do actual schema validation just like with old school JavaScript.
Re:38% of bugs at Airbnb could have been prevented by using ... by baroffoos on Monday February 11, 2019 @05:36PM (#19139130)
Better languages solve this. In haskell you define a datatype for json before you parse it.