3 ms·
Type annotations does not replace proper documentation. And with properly named parameters the annotations are not needed. It's also a convention among JavaScr
by z3t4 8y ago
Type annotations does not replace proper documentation. And with properly named parameters the annotations are not needed.
It's also a convention among JavaScript programmers that each function should not only check the parameters, but also convert them, so you can leave out optional arguments, pass a notated object {foo: "bar"}, or pass a string and have the function convert it to an array so you can write foo(bar) instead of foo([bar]) when calling the function. Or convert an object if it's not of the correct instance.
This is more fun then annotating types and having a compiler shout out weird errors at you.