As in several languages, such as C# and C++, TypeScript namespaces were conceived to avoid name collisions among different libraries and application parts in large code bases. However, they don't solve another important problem of large code bases: dependency-tracking. TypeScript modules solve both these problems, but projects based on modules require an advanced knowledge of JavaScript bundlers, and are more difficult to configure and build. Namespaces should be preferred in simpler applications based mainly on server-side processing that uses JavaScript to improve HTML page graphics, while modules should be preferred in complex, rich-client applications, such as SPAs, that move the whole presentation layer to the client side.
TypeScript modules mimic ES6-native modules but may also generate JavaScript code based on other non-native module systems, such as AMD, CommonJS...