gpt4 book ai didi

node.js - 无论如何,Typescript 都不会排除 tsconfig 的 'excludes' 数组中的文件夹(TS 3.7.2)

转载 作者:太空宇宙 更新时间:2023-11-03 22:19:50 25 4
gpt4 key购买 nike

我已经阅读了无数的线程和文档,并尝试了数十种不同的方法来使其工作,无论如何它都不会忽略该测试文件夹。

我的 TS 配置:

{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"lib": ["es2018", "dom"],
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "lib",
"strict": true,
"experimentalDecorators": true,
"esModuleInterop": true,
"strictNullChecks": true,
"strictPropertyInitialization": false,
"noImplicitAny": true,
"moduleResolution": "node"
},
"include": ["src"],
"exclude": ["**/testing/*", "testing", "**/testing/**/*"]
}

我的文件夹结构:

enter image description here

最佳答案

事实证明,排除这样的文件夹是毫无意义的,而且我在“src”文件夹等中看到的整个文件夹结构已经是出现问题的迹象,与我的 tsconfig 相比,tsconfig 应该只放置 JS 结果“src”内的文件直接在“lib”内。

我的规范文件位于 SRC 中,它们取决于“testing”文件夹中的 Assets 。一旦我使用以下方法排除了规范文件:

  "exclude": ["src/**/*.spec.ts"]

我根本不需要将测试文件夹指定为“排除”数组。现在 tsc 的结果输出此文件夹/文件结构,而无需对 tsconfig 进行其他更改:

enter image description here

关于node.js - 无论如何,Typescript 都不会排除 tsconfig 的 'excludes' 数组中的文件夹(TS 3.7.2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58919012/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com