Message from JavaScript discussions
November 2017
— Or you even can get [Note] no known conversion for argument 1 from
...
It is trying to do some things under the hood for you, and complains when it fails, but you still don't know that's because you passed the wrong type
— C++
— For comparison
— If you know C++, you know what those errors mean, but in JS you don't get anything nearly that helpful
— Without type checking you are reliant on some function in your code throwing a TypeError itself, which could be deep down in execution, several hundred calls into the stack... hard to debug
— With the asserts, one can find very easily that it is their fault
— With a lib/framework it just helps to reduce bored kids emailing me
— And it's always nice to have a unit test which specifically checks that
— Https://github.com/Floofies/Differentia.js/blob/master/spec/Spec.js#L251
— That checks for typeErrors when they are expected
— I am restricted by TDD and specs, which means I don't write buggy code anymore