title: Using typescript for ES6 support, with Angular JS
body: <p>I am looking for a transpiler that gives me the following:-</p>
  
  <ul>
  <li>Use ES6 syntax for classes, "let" scoping, fat arrow syntax</li>
  <li>Some support for imports (ideally ES6 proposed syntax)</li>
  <li>Support for IE8 (that is, compiles down to ES3)</li>
  <li>Compatibility with AngularJS</li>
  <li>Compatibility with gulp</li>
  <li>Compile all my code into a single file without requirejs/AMD.</li>
  </ul>
  
  <p>Now, most of that is covered by TypeScript, but typescript comes with its own type syntax which I prefer not using as it seems to require me to download/setup interfaces/definition files.</p>
  
  <p>I have had a play with it and I have had not much success.  You can see the code below.  Can someone either please suggest an alternative (and no, I don't want to use Dart), or tell me what I am doing wrong.</p>
  
  <p>app.ts (my "main" file)</p>
  
  <pre><code>/// &lt;reference path="MyController.ts"/&gt;
  /// &lt;reference path="MyService.ts"/&gt;
  // &lt;reference path="../bower_components/angular/angular.min.js"/&gt;
  
  angular.module("test")
        .controller("MyController", MyController.injections)
        .factory("MyService", MyService.injections);
  </code></pre>
  
  <p>MyController.ts</p>
  
  <pre><code>/// &lt;reference path="MyService.ts"/&gt;
  module MyController {
      class MyController {
          constructor(MyService) {
              this.MyService = MyService;
          }
  
          callSomething() {
              this.MyService.doSomething();
          }
      }
      export var injections = [ "MyService", MyController ];
  }
  </code></pre>
  
  <p>MyService.ts</p>
  
  <pre><code>module MyService {
      export class MyService {
          constructor($http) {
  
          }
  
          doSomething() {
              console.log("Yo");
          }
      }
      export var injections = [ "$http", MyService ];
  }
  </code></pre>
  
  <p>Here are the issues the typescript compiler's output:-</p>
  
  <pre><code>C:\dev\temp\angulargulp&gt;gulp compile
  [gulp] Using gulpfile C:\dev\temp\angulargulp\gulpfile.js
  [gulp] Starting 'compile'...
  [gulp] Finished 'compile' after 3.87 ms
  [gulp] Compiling TypeScript files using tsc version 1.0.1.0
  [gulp] [tsc] &gt; error TS5023: Unknown option 'allowimportmodule'
  [gulp] [tsc] &gt; C:\dev\temp\angulargulp\app\scripts\MyController.ts(5,9): error TS2094: The property 'MyService' does not exist on value of type 'MyController'.
  [gulp] [tsc] &gt; Use the '--help' flag to see options.
  [gulp] [tsc] &gt; C:\dev\temp\angulargulp\app\scripts\MyController.ts(9,9): error TS2094: The property 'MyService' does not exist on value of type 'MyController'.
  [gulp] [tsc] &gt; C:\dev\temp\angulargulp\app\scripts\app.ts(5,1): error TS2095: Could not find symbol 'angular'.
  [gulp] Failed to compile TypeScript: Error: tsc command has exited with code:1
  
  events.js:72
          throw er; // Unhandled 'error' event
                ^
  [←[32mgulp←[39m] Error in plugin '←[36mgulp-tsc←[39m': Failed to compile: tsc command has exited with code:1
      at C:\dev\temp\angulargulp\node_modules\gulp-tsc\index.js:51:33
      at C:\dev\temp\angulargulp\node_modules\gulp-tsc\lib\compiler.js:326:8
      at Array.forEach (native)
      at Function.Compiler._allAborted (C:\dev\temp\angulargulp\node_modules\gulp-tsc\lib\compiler.js:325:13)
      at Function.Compiler.abortAll (C:\dev\temp\angulargulp\node_modules\gulp-tsc\lib\compiler.js:303:14)
      at C:\dev\temp\angulargulp\node_modules\gulp-tsc\index.js:50:20
      at C:\dev\temp\angulargulp\node_modules\gulp-tsc\lib\compiler.js:110:7
      at Transform.&lt;anonymous&gt; (C:\dev\temp\angulargulp\node_modules\gulp-tsc\lib\compiler.js:205:5)
      at Transform.EventEmitter.emit (events.js:117:20)
      at C:\dev\temp\angulargulp\node_modules\gulp-tsc\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:942:16
  </code></pre>