禁用打字稿检查(创建React应用)

时间:2019-09-27 09:34:50

标签: reactjs typescript redux react-redux

我将一个大项目移到了启用了打字稿的"create-react-app"上。

在我之前的conf中,我没有任何打字稿错误,但是现在出现了此类错误:

Type '{ pset: string; propertyName: string; projectId: string; doUpdate: (pset: any, propertyName: any) => Promise<void>; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes<Component<Pick<unknown, never> | (Pick<Pick<unknown, never>, never> & Pick<InferProps<unknown>, never>) | (Pick<Pick<Pick<unknown, never>, never> & Pick<InferProps<unknown>, never>, never> & Partial<...> & Partial<...>) | (Pick<...> & ... 1 more ... & Partial<...>), an...'.

我正在使用redux。这是一个常见问题:Typescript + React/Redux: Property "XXX" does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes

解决起来非常棘手,我没有时间手动更改数百个文件。不能在每个错误上添加@ ts-ignore

我可以在全球范围内解决此问题吗?我的tsconfig.json中有某些选项吗?

这是我的tsconfig.json:

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": false,
    "forceConsistentCasingInFileNames": false,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react"
  },
  "include": [
    "src"
  ],
  "exclude": ["node_modules"]
}

0 个答案:

没有答案