简体   繁体   English

如何使用 eslint 忽略 TS 错误 TS2339:“类型的值上不存在属性”

[英]how Ignore TS Errors TS2339: “property does not exist on value of type” with eslint

My React js project failed and I got many times this error:我的 React js 项目失败了,我多次收到此错误:

The TS2339: property 'x' does not exist on value of type 'y' TS2339:属性“x”不存在于“y”类型的值上

my tsconfig.json file :我的 tsconfig.json 文件:

{
"compilerOptions": {
"jsx": "react",
"target": "es6",
"module": "esnext",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"outDir": "target/classes/static/app",
"lib": ["es2015", "es2017", "dom"],
"types": ["webpack-env", "jest"],
"allowJs": true,
"checkJs": false,
"baseUrl": "./",
"paths": {
  "app/*": ["src/main/webapp/app/*"]
},
"importHelpers": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
  },
  "include": ["src/main/webapp/app", "src/test/javascript/spec"],
  "exclude": ["node_modules"]
}

How fix it?怎么修?

也许将此规则添加到 tsconfig 会有所帮助

"noImplicitAnyForClassMembers": false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM