Type string trivially inferred from a string literal, remove type annotation @typescript-eslint

vue项目启动报错

在这里插入图片描述
从字符串文字中简单推断出字符串类型,删除类型注释。eslint @ typescript-eslint / no-inferrable-types
编译器觉得已经推断出是字符串类型,不需要写了

解决方案

修改.eslintrc.js在其中添加:

  rules: {
    
    
    "@typescript-eslint/no-inferrable-types": "off" // 关闭类型推断
  }

猜你喜欢

转载自blog.csdn.net/lianghecai52171314/article/details/132384287
今日推荐