gpt4 book ai didi

typescript - 停止 typescript 编译器创建 .d.ts 文件

转载 作者:搜寻专家 更新时间:2023-10-30 20:41:42 24 4
gpt4 key购买 nike

我希望 typescript 在编译时不创建 .d.ts 文件。这是因为它会导致所有类名出现“重复标识符”错误。我已将其添加到 tsconfig 文件中:

{
"compileOnSave": true,
"compilerOptions": {
"target": "es5",
"noImplicitAny": true,
"module": "system",
"moduleResolution": "node",
"sourceMap": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": true,
"outDir":"js/",
"declaration": true
},
"exclude": [
"bower_components",
"node_modules",
"wwwroot" // this is the key line
]
}

这应该会使其停止创建 .d.ts 文件,如 this answer 所示。

但我想这不是我需要排除的文件夹,因为排除它并不会阻止它为我创建 .d.ts 文件。我正在使用 Visual Studio Code 。我需要排除什么文件?

最佳答案

如果您想要不生成 d.ts文件,那么您需要删除:

declaration: true

来自 tsconfig.json 中的编译器选项

compiler options doc 中所述

--declaration -d Generates corresponding '.d.ts' file.

关于typescript - 停止 typescript 编译器创建 .d.ts 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36099544/

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