namespace keyword

TypeScript used the module keyword to define both “internal modules” and “external modules”; this has been a bit of confusion for developers new to TypeScript. “Internal modules” are closer to what most people would call a namespace; likewise, “external modules” in JS speak really just are modules now.

Note: Previous syntax defining internal modules are still supported.

Before:

  1. module Math {
  2. export function add(x, y) { ... }
  3. }

After:

  1. namespace Math {
  2. export function add(x, y) { ... }
  3. }