4 ms·
When you are writing unittests for JavaScript, does 95% of your asserts check that values are of the correct type?
by olavk 10y ago
When you are writing unittests for JavaScript, does 95% of your asserts check that values are of the correct type?
- mamp 10y agoI've been using flow type which has made the transition from F# tolerable, so none of my assertions are type checks but still a lot of null checks because of no language support of option types.
- olavk 10y agoBut if you develop without flowtype, do 95% of your JavaScript unittests consist of type checks?
- monocasa 10y agoIn a proper type system a la Haskell, ML, Rust, etc. you can encode significantly more into the type system than you can with JavaScript's rather anemic offerings, even if it were statically typed. It feels almost like contact programming in that you must handle everything out else the code won't compile.