As it is stated in the TS-handbook
there are 2 kind of modules: "internal" & "external". The code in the internal module is written in Typescript and the "external" is written in Javascript.
In order to align with new ECMAScript 2015's terminology they decided to rename them as follows:
- "Internal modules" are now "namespaces".
- "External modules" are now simply "modules", as to align with ECMAScript
So:
- The way you write your code is different
- When using modules the classes are not exposed in the global scope, while using namespaces:
Example:
Let's say you have public namespace sequence NamespaceA.NamespaceB.NamespaceC
which exposes public class ClassD
.
You can access all of these globally this way:
window.NamespaceA
window.NamespaceA.NamespaceB
window.NamespaceA.NamespaceB.NamespaceC
window.NamespaceA.NamespaceB.NamespaceC.ClassD
without saying window.NamespaceA = NamespaceA
and if you use modules you have to use the "magic" above