title: Typescript and AngularJS 1.5: How to handle export class
body: <p>I have this module.ts file:</p>
  
  <pre><code>import { IHttpService, IPromise } from 'angular';
  
  export class ProductService {
      static $inject = ["$http"];
      constructor(private $http: IHttpService) { }
  
      loaded: boolean = false;
      promise: IPromise&lt;{ data: any }&gt;;
  
      getProducts(): IPromise&lt;{ data: any }&gt; {
          if (!this.loaded) {
              this.loaded = true;
              this.promise = this.$http.get('/products.json');
          }
          return this.promise;
      }
  }
  
  var module = angular.module("psShopping", ["ngComponentRouter"]);
  module.value("$routerRootComponent", "shoppingApp");
  module.service('products', ProductService);
  </code></pre>
  
  <p>and this gets transpiled/compiled to module.js:</p>
  
  <pre><code>"use strict";
  var ProductService = (function () {
      function ProductService($http) {
          this.$http = $http;
          this.loaded = false;
      }
      ProductService.prototype.getProducts = function () {
          if (!this.loaded) {
              this.loaded = true;
              this.promise = this.$http.get('/products.json');
          }
          return this.promise;
      };
      ProductService.$inject = ["$http"];
      return ProductService;
  }());
  exports.ProductService = ProductService;
  var module = angular.module("psShopping", ["ngComponentRouter"]);
  module.value("$routerRootComponent", "shoppingApp");
  module.service('products', ProductService);
  </code></pre>
  
  <p>The problematic line is: <code>exports.ProductService = ProductService;</code> If I remove this manually - the app works perfectly. But if I leave this like that, in the browsers console I get an error "exports is not defined". 
  What can be done about this? I can't just remove "export" from the .ts file as this class is used in other files (I import it there). I tried different compiler options, but it just gives me different errors (like "define is not defined" etc) and I'm not sure how to handle this. maybe theres a way that the tsc would just not produce this line?</p>