Search⌘ K

Module

Explore the concept of modules in TypeScript and how they differ from namespaces. Understand module scope, exporting and importing elements, and the role of module loaders. Learn how to share code across files and libraries by using modules as proxies to manage dependencies.

How is a module different from a namespace?

TypeScript uses the same concept of the module as specified by ECMAScript 2015. A module is different from a namespace in many ways. The first difference is that modules do not use global scope, but rather, their own scope. A module can be created using the keyword export and it can load another module by importing using the keyword import.

Module requirements #

A module requires a module loader, of ...