While avoiding type declarations produces less verbose code, it also lessens the benefits of
documentation that static types have.
We want our code to be understandable, unambiguous, and maintainable. Quickly recognizing the correct uses of variables, properties, and function parameters will help us to avoid common coding errors and to write code that others will continue to understand.
Modern editors and development environments have come a long way since the early days. While you’d be forgotten to conclude that support for dynamically typed languages cannot ever match a statically typed one, don’t be quick to dismiss the last decade of improvements and progress that happened on this field. Editors and environments today are chock full of features and tools that can help you write code quickly and reliably. They can, for example:
Some advanced editors, like WebStorm, have built-in support for writing JSDoc. Just write “/**” in a line above function body and press enter - you’ll get all the parameters and return value listed for you. At this point, you only need to fill the description of the function and the parameters. Note that the editor will warn you if the name of the parameter in JSDoc does not match the actual name in the function. Pay attention to such warnings as they can point out glaring deficiencies in the documentation.