Type string trivially inferred from a string literal, remove type annotation @typescript-eslint/no-inferrable-types

我使用的是 vue3 + typescript + eslint
解决方法
在.eslintrc.js文件的rules 增加一行  "@typescript-eslint/no-inferrable-types": "off" // 关闭类型推断

rules: {
    "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
    "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
    "@typescript-eslint/no-inferrable-types": "off" // 关闭类型推断
  }

 

posted @ 2021-01-18 18:02  爱放屁的菜鸟  阅读(2432)  评论(0编辑  收藏  举报