简体   繁体   English

React (CRA) 全局禁用打字稿检查

[英]React (CRA) disable typescript check globally

I am working on a migration of a react project and didn't find a way of disabling typescript globally.我正在迁移 React 项目,但没有找到全局禁用打字稿的方法。 It works well with @ts-nocheck on top of each file that I need, but I would like to know if there is something easier than that.它与 @ts-nocheck 在我需要的每个文件之上配合得很好,但我想知道是否有比这更容易的事情。

Thanks.谢谢。

Maybe you can edit your tsconfig.json file with something similar to:也许您可以使用类似于以下内容的内容编辑您的tsconfig.json文件:

{
  "compilerOptions": {
      "target": "es5",
      "jsx": "react",
      "allowSyntheticDefaultImports": true,
      "alwaysStrict": false,
      "strict": false,
      "noImplicitAny": false,
      "noEmitOnError": false,
      "noUnusedLocals": false,
      "noUnusedParameters": false,
      "noFallthroughCasesInSwitch": false,
      "noImplicitReturns": false,
      "noImplicitThis": false
  },
  "include": [
      "src/*"
  ],
}

This doesn't disable it, but it's like it doesn't exists.这不会禁用它,但它就像它不存在一样。

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

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