javascript - 如何忽略 TS 错误 TS2339 : “property does not exist on value of type” with eslint

标签 javascript reactjs typescript

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

The TS2339: property 'x' does not exist on value of type 'y'

我的 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

关于javascript - 如何忽略 TS 错误 TS2339 : “property does not exist on value of type” with eslint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59720806/

相关文章:

javascript - 定时器后向用户显示不同的内容

javascript - javascript 中的函数标识

javascript - 使用 chrome 的单个用户不会出现导航菜单

javascript - React app not Building 显示代码 ELIFECYCLE

javascript - Reactjs API错误 'TypeError: fetch(...).then(...).then(...).done is not a function'

javascript - 带有 String 的 TypeScript 简单装饰器

javascript - 如何根据图像垂直条设置像素RGB值? (JavaScript)

javascript - React 计算器 - 等号逻辑

Typescript - 可选类型

typescript - 如何使用 Selenium 和 Mocha 实现 Istanbul 尔覆盖