title: Angular2: Cannot find namespace 'environment'
body: <p>I have configured my <code>tsconfig.json</code> so I can use short import paths in my code for brevity. For example, I can do <code>import { FooService } from 'core'</code> instead of being forced to do something like <code>import { FooService } from '../../../core/services/foo/foo.service'</code>.</p>
  
  <p>This works just fine, except for some reason now that I have created a new file, one of the imports is throwing an error:</p>
  
  <blockquote>
    <p>Cannot find namespace 'environment'.</p>
  </blockquote>
  
  <p>This error occurs because of the following line: <code>import { environment } from 'environment';</code></p>
  
  <p>It's very strange because I have that same import in many other services and none of them throw the error, it only happens in this new file that I created.</p>
  
  <p>This is my <code>tsconfig.json</code>:</p>
  
  <pre><code>{
    "compileOnSave": false,
    "compilerOptions": {
      "outDir": "./dist/out-tsc",
      "baseUrl": "src",
      "paths": {
        "core": ["app/core"],
        "core/*": ["app/core/*"],
  
        "shared": ["app/shared"],
        "shared/*": ["app/shared/*"],
  
        "modal": ["app/modal"],
        "modal/*": ["app/modal/*"],
  
        "environment": ["environment/environment"]// HERE
      },
      "sourceMap": true,
      "declaration": false,
      "moduleResolution": "node",
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "target": "es5",
      "typeRoots": [
        "node_modules/@types"
      ],
      "lib": [
        "es2016",
        "dom"
      ]
    }
  }
  </code></pre>
  
  <p>As you can see, the <code>paths</code> are set up properly. And if they weren't it wouldn't have worked all this time in the other files...</p>
  
  <p>What is going on here? Anyone know how to fix this?</p>