title: TypeScript error in Angular2 code: Cannot find name 'module'
body: <p>I have defined the following Angular2 component:</p>
  
  <pre><code>import {Component} from 'angular2/core';
  
  @Component({
    selector: 'my-app',
    moduleId: module.id,
    templateUrl: './app.component.html'
  })
  export class AppComponent {
  }
  </code></pre>
  
  <p>When I try to compile this, I get the following error on line 5:</p>
  
  <pre><code>src/app/app.component.ts(5,13): error TS2304: Cannot find name 'module'.
  </code></pre>
  
  <p>I believe module.id is referring to the CommonJS <code>module</code> variable (see <a href="https://angular.io/docs/js/latest/api/core/ComponentMetadata-class.html" rel="noreferrer">here</a>). I have specified the CommonJS module system in tsconfig.json:</p>
  
  <pre><code>{
    "compilerOptions": {
      "target": "es5",
      "module": "commonjs",
      "declaration": false,
      "removeComments": true,
      "noLib": false,
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "sourceMap": true,
      "pretty": true,
      "allowUnreachableCode": false,
      "allowUnusedLabels": false,
      "noImplicitAny": true,
      "noImplicitReturns": true,
      "noImplicitUseStrict": false,
      "noFallthroughCasesInSwitch": true
    },
    "exclude": [
      "node_modules",
      "dist",
      "typings/browser.d.ts",
      "typings/browser",
      "src"
    ],
    "compileOnSave": false
  }
  </code></pre>
  
  <p>How can I correct the TypeScript error?</p>