Angular4我应该使用Iterable的定义

前端之家收集整理的这篇文章主要介绍了Angular4我应该使用Iterable的定义前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已将我的应用程序升级到最新的Angular 4(beta-8)版本.但是我一直有以下错误

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

我确实查找了更改日志,发现:

A definition of Iterable<T> is now required to correctly compile Angular applications. Support for Iterable<T> is not required at runtime but a type definition Iterable<T> must be available.

我应该在这里使用什么作为Iterable定义?

编辑:

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"
  }
在更改日志中声明的 migration后,您应该在tsconfig.json中添加es2015.iterable作为lib:
{
  ...,"compilerOptions" : {
     ...,"lib": ["es6","dom","es2015.iterable"]
   }
}
原文链接:https://www.f2er.com/angularjs/143568.html

猜你在找的Angularjs相关文章