Type 'HTMLCollection' can only be iterated through when using the '–downlevelIteration' flag or with a '–target' of 'es2015' or higher

huangapple go评论119阅读模式
英文:

Type 'HTMLCollection' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher

问题

我正在尝试为我的静态网格创建一个加载器。我正在使用react-shimmer-skeleton包的源代码,同时eslint处于严格模式。以下是链接到相应的存储库文件。它一直抛出错误TS2802: Type 'HTMLCollection' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher

{element.children
  ? [...element.children]
      .map(child => renderElement(child as HTMLElement))
  : null
}

我已经能够通过使用IntelliJ IDEA解决其他由eslint引发的错误。但对于这个错误,它没有任何快速修复。是否有什么方法可以在不创建"downlevelIteration": true的情况下解决这个错误?

英文:

I am trying to create a loader for my static grid. I am using the react-shimmer-skeleton package source code while eslint is in strict mode. Here is the link for the respective repository file. It keeps throwing the error TS2802: Type 'HTMLCollection' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.

{element.children
  ? [...element.children]
      .map(child => renderElement(child as HTMLElement))
                    : null
}

I was able to resolve the other errors which were thrown by eslint using IntelliJ IDEA. But for this error, it is not having any quick fixes. Is there anything that I can do to fix this error without creating this "downlevelIteration": true.

答案1

得分: 1

我认为在这里创建"downlevelIteration": true是最简单和可行的选择。

英文:

I think creating "downlevelIteration": true is the most easy and viable option here.

huangapple
  • 本文由 发表于 2023年5月26日 11:33:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/76337494.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定