在项目中遇到警告:warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
只需要在“package.json”文件中找到“eslintConfig”配置项的“rules”,添加上 “@typescript-eslint/no-explicit-any”: [“off”]然后重启项目就行了。
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended",
"@vue/typescript/recommended"
],
"parserOptions": {
"ecmaVersion": 2020
},
"rules": { // 就这
"@typescript-eslint/no-explicit-any": ["off"] // 把他加上重启项目就行了
}
},
在TypeScript项目中遇到warningUnexpectedany.Specifyadifferenttype警告时,可以通过修改package.json文件中的eslintConfig规则,将@typescript-eslint/no-explicit-any设置为off来关闭此警告。只需添加这一条规则并重启项目,警告即可消除。
9523

被折叠的 条评论
为什么被折叠?



