typescript - error TS2304: Build:Cannot find name 'Iterable' after upgrading to Angular 4 -
i using typescript 2.4.1 , have upgraded many packages in project. among them upgraded angular 2 4.3.1. after many corrections in @types packages, errors left are:
\node_modules\@types\jquery\index.d.ts(2955,63): error ts2304: build:cannot find name 'iterable'. \node_modules\@types\three\three-core.d.ts(767,24): error ts2304: build:cannot find name 'iterable'. \node_modules\@types\three\three-core.d.ts(771,24): error ts2304: build:cannot find name 'iterable'. \node_modules\@types\three\three-core.d.ts(775,24): error ts2304: build:cannot find name 'iterable'. \node_modules\@types\three\three-core.d.ts(779,24): error ts2304: build:cannot find name 'iterable'. \node_modules\@types\three\three-core.d.ts(783,24): error ts2304: build:cannot find name 'iterable'. \node_modules\@types\three\three-core.d.ts(787,24): error ts2304: build:cannot find name 'iterable'. \node_modules\@types\three\three-core.d.ts(791,24): error ts2304: build:cannot find name 'iterable'. \node_modules\@types\three\three-core.d.ts(795,24): error ts2304: build:cannot find name 'iterable'. \node_modules\@types\three\three-core.d.ts(799,24): error ts2304: build:cannot find name 'iterable'.
i have found many similar questions , answers , prevailing solution target "es2015" and/or add lib: ["dom", "es2015", "es2015.iterable"]. have tried , more still left same 'iterable' error.
my updated tsconfig.json thus:
{ "compileonsave": true, "compileroptions": { "declaration": false, "emitdecoratormetadata": true, "experimentaldecorators": true, "lib": [ "dom", "dom.iterable", "es2015", "es2015.iterable", "esnext" ], "module": "commonjs", "moduleresolution": "node", "noimplicitany": true, "noemitonerror": true, "outdir": "./wwwroot/js", "removecomments": false, "rootdir": "./client", "sourcemap": true, "suppressimplicitanyindexerrors": true, "target": "es2015", "typeroots": [ "./node_modules/@types", "./client" ] }, "exclude": [ "node_modules", "wwwroot/lib" ], "filesglob": [ "./client/**/*.ts" ] }
my package.json is:
{ "version": "1.0.0", "name": "web-server", "private": true, "dependencies": { "@angular/common": "^4.3.1", "@angular/compiler": "^4.3.1", "@angular/core": "^4.3.1", "@angular/forms": "^4.3.1", "@angular/http": "^4.3.1", "@angular/platform-browser": "^4.3.1", "@angular/platform-browser-dynamic": "^4.3.1", "@angular/router": "^4.3.1", "@angular/upgrade": "^4.3.1", "bootstrap": "3.3.7", "core-js": "2.4.1", "lodash": "4.17.4", "pixi.js": "4.5.4", "reflect-metadata": "0.1.10", "rxjs": "^5.4.2", "systemjs": "0.20.17", "three": "0.86.0", "zone.js": "0.8.14" }, "devdependencies": { "@types/chai": "^4.0.1", "@types/jquery": "3.2.9", "@types/lodash": "4.14.71", "@types/mocha": "2.2.41", "@types/pixi.js": "4.5.2", "@types/three": "0.84.19", "bower": "^1.8.0", "gulp": "3.9.1", "gulp-clean": "^0.3.2", "gulp-concat": "^2.6.1", "gulp-typescript": "^3.2.1", "gulp-inline-ng2-template": "^4.0.0", "gulp-sourcemaps": "^2.6.0", "gulp-tsc": "^1.3.2", "gulp-uglify": "^3.0.0", "merge2": "^1.1.0", "path": "^0.12.7", "rimraf": "^2.6.1", "systemjs-builder": "^0.16.9", "typescript": "2.4.1" }, "scripts": { "gulp": "gulp", "rimraf": "rimraf", "bundle": "gulp bundle", "postbundle": "rimraf dist" } }
how can "iterable" not found after lib inclusions? typescript compiler not ignore tsconfig.json changing option gives various outputs, none without errors.
my environment visual studio 2015 update 3 typescript tools 2.4.1. using npn @types (no typings). verbose compilation output shows visual studio uses 2.4.1 version.
and bizarre thing compiling using gulp gives no error using same typescript version , tsconfig.
this looks described here:
https://github.com/definitelytyped/definitelytyped/issues/16939
so either try using
"target": "es6"
as described there - or works us:
"target": "es5", "lib": ["es2016","dom"]
Comments
Post a Comment