3 ms·
It is actually the same in static typing. JavaScript didn't need formal classes and argument and return types, until Node, NPM, and other large scale projects m
by slver 6y ago
It is actually the same in static typing. JavaScript didn't need formal classes and argument and return types, until Node, NPM, and other large scale projects made those necessary (ergo, TypeScript).
Even when using TypeScript, typing your local variables isn't THAT useful. Some do it out of sense of diligence, but the odds are you know what's the type of a local variable in a 30 line method, just by looking at the code.
But for libraries to cooperate, or even people to cooperate within a single large project, that represents objects and functions used by multiple callers who don't know that code by heart, and aren't looking at its implementation while using it. Hence, types.