Javascript 如何忽略TS错误TS2339:&x201C;类型为”;的值上不存在属性;用埃斯林

Javascript 如何忽略TS错误TS2339:&x201C;类型为”;的值上不存在属性;用埃斯林,javascript,reactjs,typescript,Javascript,Reactjs,Typescript,我的React js项目失败,我多次遇到此错误: TS2339:类型为“y”的值上不存在属性“x” 我的tsconfig.json文件: { "compilerOptions": { "jsx": "react", "target": "es6", "module": "esnext", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": t

我的React js项目失败,我多次遇到此错误:

TS2339:类型为“y”的值上不存在属性“x”

我的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"]
}

如何修复它?

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

"noImplicitAnyForClassMembers": false

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

"noImplicitAnyForClassMembers": false

你确定这是从埃斯林特来的吗。这看起来像是typescript编译器的问题。你能展示一个例子的完整输出吗?这可能是组件状态和/或道具之间的输入不匹配。请发布更多代码。您确定这是来自eslint的吗。这看起来像是typescript编译器的问题。你能展示一个例子的完整输出吗?这可能是组件状态和/或道具之间的输入不匹配。请发布更多代码