The Visual Basic instruction is Option Explicit. Other environments, e. g., Perl, have use strict; that invokes a package. There might be something like that in Typescript, but I am unaware of anything along those lines for Javascript. On the other hand, I use JS as infrequently as possible, for all the reasons you said, and many others. If you're serious about JS, you really need a good linter and a robust set of rules to guide it, not to mention a decent visual debugger. When necessity requires it, I lean heavily on the Chrome Dev Tools.
David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting