【问题标题】:how can I change a tsconfig property for a specific folder in my application?如何更改应用程序中特定文件夹的 tsconfig 属性?
【发布时间】:2021-10-23 10:58:25
【问题描述】:

这是我项目的结构

app/
   |--src/
         |--folder
   |--tsconfig.json

这是我的 tsconfig 文件

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

所以我想让整个应用的严格属性为真,除了那个文件夹

【问题讨论】:

    标签: reactjs directory tsconfig strict


    【解决方案1】:

    不,您不能将一个或多个 ts 配置属性应用于特定目录或任何 ts 文件。

    Ts 配置将应用于您在"include" 属性中提到的所有文件。

    【讨论】:

    • 我应该为该特定文件夹创建一个新的 tsconfig 文件还是直接排除它
    • 您可以通过创建另一个 tsconfig 文件来实现。我会更新答案
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多