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" // 关闭类型推断
  }
原文地址:https://www.cnblogs.com/fczbk/p/14294022.html