停止typescript编译器创建.d.ts文件
我希望typescript在编译时不要创建.d.ts文件。这是因为它会在所有类名上导致“重复标识符”错误。我已将其添加到tsconfig文件中:停止typescript编译器创建.d.ts文件,typescript,visual-studio-code,Typescript,Visual Studio Code,我希望typescript在编译时不要创建.d.ts文件。这是因为它会在所有类名上导致“重复标识符”错误。我已将其添加到tsconfig文件中: { "compileOnSave": true, "compilerOptions": { "target": "es5", "noImplicitAny": true, "module": "system", "moduleResolution": "node",
{
"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文件,如中所示
但我想这不是我需要排除的文件夹,因为排除它不会阻止它为我创建.d.ts文件。我正在使用VisualStudio代码。我需要排除哪些文件?如果希望不生成
d.ts
文件,则需要删除:
declaration: true
从tsconfig.json
如
--声明-d生成相应的“.d.ts”文件
您能澄清导致此错误的定义吗?@MaxFX由于.d.ts文件,任何类名或变量名都有错误。当我手动删除文件时,错误会消失,但当我重新编译时,它会重新创建文件