美文网首页
Property 'fill' does not exist o

Property 'fill' does not exist o

作者: 百變Confucius | 来源:发表于2020-11-13 15:10 被阅读0次

在typescript中:
new Array(9).fill('ab')
但是tsc的时候报错:
Property 'fill' does not exist on type 'any[]'.

我们只需要把tsconfig.json里面的target改成es6就可以了:
"target": "es6",

相关文章

网友评论

      本文标题:Property 'fill' does not exist o

      本文链接:https://www.haomeiwen.com/subject/upovbktx.html