Skip to content
Example of progression conversion from TypeScript namespaces to modules
TypeScript JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This repository demonstrates how to progressively convert a TypeScript library that uses global namespaces over to using modules.

The src/entry.m.ts file is the main entry point in the webpack config. This file calls namespaced code and also imports a module shim that runs namcespaced code. Progressively, namespaced code can be shimmied and then the namespaced code eventually folded directly into the modules.

The npm script "bundle" builds the namespace project which emits the outFile dist/script.js. This file is referenced in the index.html file before the webpack bundle is loaded.


  1. Run npm install
  2. Run npm run start
  3. Open http://localhost:5000 in a browser
  4. Open devtools console and you should see:
bite bite bite bite
bark bark bark bark
You can’t perform that action at this time.