2016-07-15 29 views
0

我運行一個角2項目,打字稿,我有很多錯誤,從我的角度網絡模塊打字稿:在庫文件夾排除檢查

[error] node-modules\webjars\@angular\common\src\directives\ng_class.d.ts:80: TS2304 Cannot find name 'Set'. 
[error]  rawClass: string | string[] | Set<string> | { 
[error]         ^
[error] node-modules\webjars\@angular\common\src\facade\async.d.ts:33: TS2304 Cannot find name 'Promise'. 
[error]  static fromPromise(promise: Promise<any>): Observable<any>; 
[error]        ^
[error] node-modules\webjars\@angular\common\src\facade\async.d.ts:34: TS2304 Cannot find name 'Promise'. 
[error]  static toPromise(obj: Observable<any>): Promise<any>; 
[error]  

顯然來了,我不希望我的打字稿檢查這些庫,因此,我已經建立了我的tsconfig.json如下:

{ 
    "compilerOptions": { 
    "target": "es5", 
    "module": "system", 
    "moduleResolution": "node", 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators":true, 
    "sourceMap": true, 
    "noImplicitAny":true, 
    "noFallthroughCasesInSwitch":true, 
    "noImplicitReturns":true, 
    "outDir": "./target/ts" 
    }, 
    "exclude": [ 
    "node_modules", 
    "project/target", 
    "typings/main", 
    "typings/main.d.ts", 
    "typings/browser", 
    "target/web" 
    ] 
} 

還有什麼我應該做的事?

回答

2

不完全確定爲什麼在angular 2 quickstarttsconfig.json他們刪除了exclude參數。但是,是的,你是對的。這就是你應該做的。用於這個樣子,在我的腦海中exclude,仍然應該是這樣的:

tsconfig.json

... 
"exclude": [ 
    "node_modules", 
    "typings/globals" 
] 
+0

更奇怪的是,它曾經運行良好,當我從beta-17升級到rc.4時,問題確實出現了 – Scipion

0

我設法通過增加回解決這個問題:

.../angular2/typings/browser.d.ts in my typings.d.ts 

我不明白的是,這個文件來自angular2(它是beta-17的一部分),我在最新的rc(4)中找不到與此相關的任何東西。