Search⌘ K

Namespace

Explore how namespaces in TypeScript are used to logically organize code and minimize naming collisions within the global scope. Understand their limitations as applications grow and why modules offer a more scalable approach to code sharing and dynamic loading.

Namespace: A fading concept

The concept of namespaces in TypeScript is fading away with the second, more powerful way to share code: a module. A namespace is a basic object assigned to the global space. The object, named after the name of the namespace, holds the functions created within this one.

TypeScript 3.3.4
namespace myNamespace {
// code here
}
// Access by using: myNamespace.

Goal of using a namespace

TypeScript ...