Cannot find global type "IterableIterator" with Typescript 1.7.5

I installed NPM Typescript version 1.7.5 and angular2 beta. When creating a project in Visual Studio 2015 Update 1, I get the following errors:

1>VSTSC : error TS2318: Build: Cannot find global type 'Iterable'. 1>VSTSC : error TS2318: Build: Cannot find global type 'IterableIterator'. 1>VSTSC : error TS2318: Build: Cannot find global type 'Symbol'. 1>VSTSC : error TS2468: Build: Cannot find global value 'Symbol'. 

My tsconfig.json file is as follows:

 { "compilerOptions": { "noImplicitAny": false, "noEmitOnError": true, "removeComments": true, "sourceMap": true, "target": "es6", "module": "system", "emitDecoratorMetadata": true, "experimentalDecorators": true, "noLib": false }, "exclude": [ "node_modules", "wwwroot", "bower_components" ], "files": [ "node_modules/angular2/typings/tsd.d.ts", "node_modules/angular2/typings/zone/zone.d.ts", "node_modules/angular2/core.d.ts", "node_modules/typescript/lib/lib.d.ts" ] } 

How to fix this error?

UPDATE:

I tried to answer Martin Vsetichke. I get the following errors:

 1>C:\Test\node_modules\angular2\src\facade\lang.d.ts(2,22): error TS2304: Build: Cannot find name 'BrowserNodeGlobal'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(6,14): error TS2300: Build: Duplicate identifier 'PropertyKey'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(9,5): error TS2300: Build: Duplicate identifier 'done'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(10,5): error TS2300: Build: Duplicate identifier 'value'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(248,5): error TS2300: Build: Duplicate identifier 'EPSILON'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(283,5): error TS2300: Build: Duplicate identifier 'MAX_SAFE_INTEGER'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(290,5): error TS2300: Build: Duplicate identifier 'MIN_SAFE_INTEGER'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(346,5): error TS2300: Build: Duplicate identifier 'flags'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(498,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(561,5): error TS2300: Build: Duplicate identifier 'size'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(570,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(581,5): error TS2300: Build: Duplicate identifier 'size'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(590,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(605,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(619,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(3841,14): error TS2300: Build: Duplicate identifier 'PropertyKey'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4061,5): error TS2300: Build: Duplicate identifier 'EPSILON'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4096,5): error TS2300: Build: Duplicate identifier 'MAX_SAFE_INTEGER'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4103,5): error TS2300: Build: Duplicate identifier 'MIN_SAFE_INTEGER'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4389,5): error TS2300: Build: Duplicate identifier 'done'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4390,5): error TS2300: Build: Duplicate identifier 'value'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4619,5): error TS2300: Build: Duplicate identifier 'flags'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4647,5): error TS2300: Build: Duplicate identifier 'size'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4657,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4674,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4686,5): error TS2300: Build: Duplicate identifier 'size'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4696,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4712,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(5099,5): error TS2300: Build: Duplicate identifier 'prototype'. 

When I tried to answer by David Sherrit, I get 14,175 errors. Errors begin with:

 1>C:\Test\node_modules\angular2\src\facade\lang.d.ts(2,22): error TS2304: Build: Cannot find name 'BrowserNodeGlobal'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(6,14): error TS2300: Build: Duplicate identifier 'PropertyKey'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(9,5): error TS2300: Build: Duplicate identifier 'done'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(10,5): error TS2300: Build: Duplicate identifier 'value'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(248,5): error TS2300: Build: Duplicate identifier 'EPSILON'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(283,5): error TS2300: Build: Duplicate identifier 'MAX_SAFE_INTEGER'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(290,5): error TS2300: Build: Duplicate identifier 'MIN_SAFE_INTEGER'. 

UPDATE:

I tried this:

 { "compilerOptions": { "noImplicitAny": false, "noEmitOnError": true, "removeComments": true, "sourceMap": true, "target": "es6", "module": "system", "emitDecoratorMetadata": true, "experimentalDecorators": true, "noLib": false }, "exclude": [ "node_modules", "wwwroot", "bower_components" ], "files": [ "node_modules/angular2/core.d.ts", "node_modules/typescript/lib/lib.d.ts", "node_modules/typescript/lib/lib.es6.d.ts" ] } 

But all the same, around 14162 errors, which are mainly associated with duplicates. Turning noLib to true did not help.

0
angular typescript
source share
2 answers

It seems that you added lib.d.ts twice because you use noLib , and you specifically add node_modules/typescript/lib/lib.d.ts to files .

I would just delete the path "node_modules/typescript/lib/lib.d.ts" .

There is also a problem with similar errors you get: https://github.com/Microsoft/TypeScript/issues/5504

+1
source share

Normally, when noLib set to true and target set to es6 , it will include lib.es6.d.ts in addition to lib.d.ts lib.es6.d.ts contains definitions specific to ES6.

However, you include lib.d.ts , which has this statement at the top of this file:

 /// <reference no-default-lib="true"/> 

This overrides your tsconfig.json parameter and sets noLib to true ; therefore it does not include lib.es6.d.ts This explains your mistakes.

If you want to continue using the definition files from node_modules/typescript/... , you also need to enable lib.es6.d.ts :

 "files": [ "node_modules/angular2/typings/tsd.d.ts", "node_modules/angular2/typings/zone/zone.d.ts", "node_modules/angular2/core.d.ts", "node_modules/typescript/lib/lib.d.ts", "node_modules/typescript/lib/lib.es6.d.ts" ] 

Otherwise, follow Martin's answers, saving noLib as false and remove the link to lib.d.ts in the file list.

+1
source share

All Articles