title: @types not working in Angular 4 TypeScript app
body: <p>I have a small Angular 4 app written with TypeScript, which also uses Webpack, and the Jasmine testing framework.</p>
  
  <p>I have installed @types packages for Jasmine and Node, e.g: <code>@types/jasmine</code> and <code>@types/node</code>, and can seem them there in the node_modules folder.</p>
  
  <p>However, when I build the app I see errors in the command line window such as:</p>
  
  <blockquote>
    <p>ERROR in [at-loader] ./app/welcome/app.welcome.spec.ts:4:1
        TS2304: Cannot find name 'describe'.</p>
  </blockquote>
  
  <p>The app itself still seems to work, it's just annoying seeing these errors.</p>
  
  <p>My package.json file is as follows:</p>
  
  <pre><code>{
      "name": "ng4-ts-demo",
      "version": "1.0.0",
      "description": "An Angular4 with TypeScript demo",
      "main": "main.ts",
      "scripts": {
          "test": "karma start",
          "build": "webpack --config webpack.config.js"
       },
       "author": "Dan",
       "license": "MIT",
       "devDependencies": {
           "@types/jasmine": "^2.5.52",
           "@types/node": "^7.0.31",
           "angular2-template-loader": "^0.6.2",
           "awesome-typescript-loader": "^3.1.3",
           "clean-webpack-plugin": "^0.1.16",
           "css-loader": "^0.28.1",
           "html-loader": "^0.4.5",
           "html-webpack-plugin": "^2.28.0",
           "jasmine-core": "^2.6.1",
           "karma": "^1.6.0",
           "karma-chrome-launcher": "^2.1.0",
           "karma-coverage": "^1.1.1",
           "karma-jasmine": "^1.1.0",
           "karma-sourcemap-loader": "^0.3.7",
           "karma-webpack": "^2.0.3",
           "node-sass": "^4.5.2",
           "sass-loader": "^6.0.3",
           "style-loader": "^0.17.0",
           "typescript": "^2.3.4",
           "webpack": "^2.4.1"
       },
       "dependencies": {
           "@angular/cli": "^1.0.2",
           "@angular/common": "^4.1.0",
           "@angular/compiler": "^4.1.0",
           "@angular/core": "^4.1.0",
           "@angular/platform-browser": "^4.1.0",
           "@angular/platform-browser-dynamic": "^4.1.0",
           "core-js": "^2.4.1",
           "moment": "^2.18.1",
           "reflect-metadata": "^0.1.10",
           "rxjs": "^5.3.1",
           "zone.js": "^0.8.9"
       }
  }
  </code></pre>
  
  <h2>Edit</h2>
  
  <p>I've fixed the Jasmine issues by importing the types module in my test-main.ts file:</p>
  
  <pre><code>import '@types/jasmine';
  </code></pre>
  
  <p>However, importing the Node types in my main.ts file does not resolve the issue. It does remove the errors such as:</p>
  
  <blockquote>
    <p>ERROR in [at-loader] ./test-main.ts:16:18
        TS2304: Cannot find name 'require'.</p>
  </blockquote>
  
  <p>But instead I see the error:</p>
  
  <blockquote>
    <p>ERROR in ./main.ts
    Module not found: Error: Can't resolve '@types/node'</p>
  </blockquote>
  
  <p>And in the browser's console I see a similar message </p>
  
  <blockquote>
    <p>Uncaught Error: Cannot find module "@types/node"</p>
  </blockquote>
  
  <h2>Edit 2</h2>
  
  <p>The Jasmine errors were only fixed when doing a regular build. When actually running the tests (with Karma), I see:</p>
  
  <blockquote>
    <p>Module not found: Error: Can't resolve '@types/jasmine'</p>
  </blockquote>
  
  <p>I've been using the <a href="https://angular.io/guide/webpack" rel="nofollow noreferrer" title="official Angular Webpack docs">official Angular/Webpack docs</a>, and this does not mention these errors, or do any importing of <code>@types</code> anywhere, and from what I have seen everywhere, the <code>@types</code> should just work once they are installed..?</p>
  
  <p>The .tsconfig file is located at the root of the project (same level as node_modules) and is as follows:</p>
  
  <pre><code>{
      "compilerOptions": {
          "target": "es5",
          "module": "commonjs",
          "moduleResolution": "node",
          "sourceMap": true,
          "emitDecoratorMetadata": true,
          "experimentalDecorators": true,
          "lib": [ "es2015", "dom" ],
          "noImplicitAny": true,
          "suppressImplicitAnyIndexErrors": true
      }
  }
  </code></pre>