3 ms·
I'm not a 'Typing is Safety' person - languages I use tend to be strongly, dynamically typed. At least one study has shown more errors come from other issues ot
by nailer 9y ago
I'm not a 'Typing is Safety' person - languages I use tend to be strongly, dynamically typed. At least one study has shown more errors come from other issues other than type mismatches and that's also my own experience.
That said: as my ES2017 app gets more complex, a little type safety could be useful. I think it might catch more stuff - eg, earlier this week I tried to use a Promise (because I forgot an 'await') and then got a bunch of NaNs on invoices (the unit tests had the await, so passed, the route didn't).
Renaming something to .ts and adding a quick compilation step doesn't seem like a big deal and would catch that error. Typescript also has a MASSIVE amount of community support around it. So yeah: still don't believe 'typing is safety' but will likely end up using TypeScript by the end of the year.
- slackingoff2017 9y agoIMO the static analysis that becomes possible from using types is more useful than types themselves. My favorite JS gotcha is the number of special values a variable can take on. NaN, Undefined, null, Infinity, -Infinity, maybe more? Also the fact that arrays and objects are always truthy. Honorable mention for the seemingly random results of concatenating strings. I'm tired of getting burned by these design flaws and if it takes strong typing to be protected from them than so be it.