This is a solution applicable in the context of using TypeScript in a project that runs in Node.js as apposed to in the browser. Additionally, it also covers exporting your code as a library to be imported by an external tool.
Say having your code spread across multiple files and directories is not an option. The code needs to all be in one single file.
For example, one of the following might apply:
AMD
or System.js
module systems to run your bundled code.