angular typescript Uncaught ReferenceError: exports is not defined
<p>Almost similar questions have been asked but relate to specific components such as gulp or webpack.</p>

<p>I am using VSCode and have installed the TypeScript libraries using TSD (I know it's deprecated but try finding any documentation on Typings and we'll talk again).</p>

<pre><code>     /// &lt;reference path="../typings/jquery/jquery.d.ts" /&gt;
     /// &lt;reference path="../typings/angularjs/angular.d.ts" /&gt;
     var app = angular.module('app', ['ngMaterial', 'ngMessages', 'material.svgAssetsCache']);

     export interface IAppController {
        someFunc: (index:number) =&gt; void;
     }

     /*export*/ class AppController implements IAppController {
        static $inject = ["$scope", "$mdDialog"];    
        private $scope : any; 
        private $mdDialog : any;        
        constructor($scope, $mdDialog) {  
           this.$scope = $scope;     
           this.$mdDialog = $mdDialog;
        };    
        someFunc(index) {
              //...
           };
     }

     app.controller('appCtrl', AppController);
</code></pre>

<p>If the /<em>export</em>/ in front of the AppController class is not commented then the js produced from the ts will contain and fail on this line:</p>

<pre><code>  exports.AppController = AppController;
</code></pre>

<p>with the error Uncaught ReferenceError: exports is not defined.</p>

<p>Which brings the following questions:</p>

<ul>
<li><p>Why is this failing on the class but not the interface?</p></li>
<li><p>Why export the controller class in the first place?</p></li>
<li><p>Where is exports defined and what additional module should be installed?</p></li>
</ul>