However, there are two limitations to keep in mind: You can also add declarations to the global scope from inside a module: Global augmentations have the same behavior and limits as module augmentations. We learn how to declare a namespace and how to access members from a namespace inside the current file or an external file. Some of the unique concepts in TypeScript describe the shape of JavaScript objects at the type level. Namespaces are simply named JavaScript objects in the global namespace. The purpose of this guide is to teach you how to write a high-quality definition file. You can call the function greet with a string to show a greeting to the user. TypeScript uses declaration files to understand the types and function signatures of a module. Custom TypeScript modules (module foo {}) and namespaces (namespace foo {}) are considered outdated ways to organize TypeScript code. Normal namespace allows also values. In the example above, we place namespace declarations in a separate file and import them using an import statement. TypeScript is a superset developed and maintained by Microsoft.It is a strict syntactical superset of JavaScript and adds optional static typing to the language. You can provide LogOptions to .log(...) and alert options to .alert(...). The simplest, and perhaps most common, type of declaration merging is interface merging. Understanding what is created with each declaration will help you understand what is merged when you perform a declaration merge. In typescript there are two types of modules: Internal modules Used for organizing our application.We segregate the types in our application into different modules.This helps with managing the application.This is similar to namespaces in c#. Type-creating declarations do just that: they create a type that is visible with the declared shape and bound to the given name. If the variable is read-only, you can use declare const. Namespace-creating declarations create a namespace, which contains names that are accessed using a dotted notation. We call declarations that don’t define an implementation “ambient”. You can also use declare let if the variable is block-scoped. This merged definition has the features of both of the original declarations. Type-creating declarations do just that: they create a type that is visible with the declared shape and bound to the given name. Type-creating declarations do just that: they create a type that is visible with the declared shape and bound to the given name. Variable Declaration in TypeScript. The declaration merge of Animals in this example: This model of namespace merging is a helpful starting place, but we also need to understand what happens with non-exported members. Because this library is loaded through a