本文介绍了Angular4我应该使用Iterable的什么定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将我的应用程序升级到了最新的Angular 4(beta-8)版本.但是我仍然遇到以下错误:

I have upgraded my app to the latest Angular 4 (beta-8) version. However I keep having the following error :

我确实查看了变更日志并发现:

I did look up the changelog and found :

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

What should I use as Iterable definition here ?

tsconfig.json

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"
  }

推荐答案

遵循 迁移 在他们的变更日志中指出,您应该将es2015.iterable作为lib添加到tsconfig.json中:

Following the migration stated in their changelog you should add es2015.iterable as a lib inside your tsconfig.json:

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

这篇关于Angular4我应该使用Iterable的什么定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 21:46