3 ms·
Firstly good spot on the '||' instead of an '&&'. Will fix that now. Secondly I completely agree about wanting a program to crash noisily and detectably in dev
by jonbretman 13y ago
Firstly good spot on the '||' instead of an '&&'. Will fix that now.
Secondly I completely agree about wanting a program to crash noisily and detectably in development, but in production I would prefer that the error is handled and the user can continue to use the app.
Finally I also agree that if type checking is really important to you, a compile to JS language like TypeScript or Dart are the best options. The techniques / approach I am discussing in this article are really for people who already have a large vanilla JS code base or want to learn a bit more about types in JavaScript.
- vladiliescu 13y agoJust wanted to add that TypeScript is backwards compatible with JS, so having a large vanilla JS code base doesn't really matter - it's already valid TypeScript code, so you can go and start adding type annotations and whatnot.
- hrjet 13y agoTypescript is a superset of Javascript. So any vanilla JS code base can be easily ported to Typescript.
- nfoz 13y ago> in production I would prefer that the error is handled and the user can continue to use the app. Maybe that's ok if it's a game or something, but this is a dangerous strategy. How do you know it's ok to use the app if there's an error? You have to very carefully isolate and control where your errors can be, and I'm not sure this approach allows you to do that.