Angular 2 compiler trouble picking up interface import

时间:2017-03-22 18:39:28

标签: angular angular2-compiler

I'm have project that I was previously building with webpack + awesome-typescript-loader and am trying to use ngc so that I can do AOT compilation. However, when run ngc "node_mdoules/.bin/ngc" -p tsconfig-aot.json I get an error:

Error at 
C:/path/Scripts/aot/Scripts/apps/shared/shared.app.module.ngfactory.ts:205:136: Property 'RequestOptionsArgs' does not exist on type 'typeof "C:/path/node_modules/@angular/http/src/interfaces".

This makes sense, I'm using that interface in one of my services

import { RequestOptions, RequestOptionsArgs } from '@angular/http';  

If I browse to where it's looking thats /node_modules/@angular/http/src/interfaces.js and the interface is defined in the adjacent /node_modules/@angular/http/src/interfaces.d.ts.

What I don't understand is how to make it pick up that interface in the interfaces.d.ts.

Here's my tsconfig-aot.json:

{
  "compilerOptions": {
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false,
    "suppressImplicitAnyIndexErrors": true
  },
  "types": [
    "core-js"
  ],
  "angularCompilerOptions" : {
    "genDir" : "Scripts/aot",
    "skipMetadataEmit" : true
  }
}

The differences from the original are the module type "commonjs" -> es2015 and the new angularCompiler options.

0 个答案:

没有答案