In this chapter, we have learned about a ton of new things.
First and most importantly, we considered modules, which are crucial in today's JavaScript/TypeScript ecosystem. Using modules, we were able to dramatically improve the organization of our code. Thanks to them, each and every piece of our application is now cleanly isolated and can clearly define what it needs to import (that is, its dependencies) and what it exposes to the outside world using exports (that is, its public API).
We first saw where modules come from, and how they've evolved over time to finally become part of the ECMAScript specification. This led us to discuss the Revealing Module pattern, AMD, CommonJS, System, and UMD. After that, we discovered how to use them with TypeScript, including the following:
- How to import modules and use destructuring
- How to export modules
- How to define barrels...