JavaScript TypeScript: exposing module types in the global context and why to avoid it Javascript modules have been around for a while, and there are plenty of good reasons why to use them, instead of writing code directly in the global scope. However, you might find yourself