Scipion
Scipion

Reputation: 11888

Typescript: Exclude checks on library folders

I am running an Angular 2 project with typescript and I am having many errors coming from my angular web-modules

[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]       

Obviously, I don't want my typescript to check these libraries, thus I have set up my tsconfig.json as followed :

{
  "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"
  ]
}

Is there anything else I should be doing ?

Upvotes: 0

Views: 1081

Answers (2)

Scipion
Scipion

Reputation: 11888

I managed to fix the issue by adding back :

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

What I don't get though, is that this file is coming from angular2 (which is part of the beta-17) and I don't find any thing corresponding to this in the latest rc (4).

Upvotes: 0

Poul Kruijt
Poul Kruijt

Reputation: 71921

Not entirely sure why in the angular 2 quickstart tsconfig.json they removed the exclude parameter. But yes, you are right. That's all you should be doing. The exclude used to look like this and in my mind, should still look like this:

tsconfig.json

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

Upvotes: 2

Related Questions