英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论