Angular4 What Iterable Definition Should Be Used

I updated my application to the latest version of Angular 4 (beta-8). However, I keep the following error:

@angular\core\src\change_detection\differs\iterable_differs.d.ts:14: TS2304 Cannot find name 'Iterable'

I looked through the change log and found:

Now, to correctly compile Angular applications, an Iterable<T> definition is required. Iterable<T> support is not required at run time, but an Iterable<T> type definition must be available.

What should I use as an Iterable definition here?

EDIT:

tsconfig.json

 "compilerOptions": { "target": "es5", "module": "commonjs", "moduleResolution": "node", /* for reading your ts source while debugging from a browser */ "sourceMap": true, /* the following two settings are required for angular2 annotations to work*/ "emitDecoratorMetadata": true, "experimentalDecorators":true, /* noImplicitAny when you want your typescript to be fully typed */ "noImplicitAny":false, "suppressImplicitAnyIndexErrors":true, "noFallthroughCasesInSwitch":true, "noImplicitReturns":true, "outDir": "./target/ts" } 
+1
source share
2 answers

Following the migration listed on their es2015.iterable , you should add es2015.iterable as lib inside your tsconfig.json :

 { ..., "compilerOptions" : { ..., "lib": ["es6", "dom", "es2015.iterable"] } } 
+4
source

I tried the accepted answer to this question, but in my case it did not work.

In my case, I added the line below to my main.ts

 ///<reference path="./../typings/globals/core-js/index.d.ts"/> 

who fixed the problem, hope this helps someone.

0
source

Source: https://habr.com/ru/post/1266041/


All Articles