angular: Cannot find name 'Iterable'.

I’m submitting a … (check one with “x”)

[x ] bug report

Current behavior

I recently upgraded my angular 2 project to 4.0.0-beta.8. But when I try to compile, it throws below error:

node_modules/@angular/core/src/change_detection/differs/iterable_differs.d.ts(15,48): error TS2304: Cannot find name ‘Iterable’.

I have also seen a question with similar error on stackoverflow but no one has responded yet.

http://stackoverflow.com/questions/42252002/angular2-cannot-find-name-iterable-in-core

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22 (10 by maintainers)

Commits related to this issue

Most upvoted comments

@naveedahmed1 I know you fixed it, but lets try something else, if it doesn’t work just go back to what solved your issue.

Remove the line you posted above and add this in your tsconfig.json

"compierOptions" : {
     "lib" : ["es2015", "es2015.iterable", "dom"]
}

if that works, try removing es2015.iterable, if that doesn’t work ignore everything 😛

PS : Also consider using the @types form to declare your typings. PS2: If you already solved your problem please close this issue, thanks.

It increased the number of errors to 2297

I came across same issues. Fixed it by adding parameter in tsconfig.json "skipLibCheck": true.

If you add lib: ["es2015", "es2015.iterable"] (as seen here) to your compilerOptions, does it work?

This worked for me:

npm i @types/node --save-dev`

The node typing contains the Iterable definition for --lib es5 it seems.

node_modules/@ types/node/index.d.ts

interface Iterable<T> { }
interface Iterator<T> {
    next(value?: any): IteratorResult<T>;
}

In my main.ts I removed

/// <reference path="./../typings/browser/ambient/es6-shim/index.d.ts" />

and added

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

Same issue. adding

"compierOptions" : {
     "lib" : ["es2015", "es2015.iterable", "dom"]
}

solved it. Thanks @ericmartinezr !

I added this and it fixed all my new typescript warnings.

“lib”: [“es2015”, “es2017”, “dom”]

You can read this

lib manual

typescript lib origination doc

related issue and ref