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

Ben*_*ins 5 typescript visual-studio-code

我希望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
  ]  
}
Run Code Online (Sandbox Code Playgroud)

这应该使它停止创建.d.ts文件,如本答案所示

但我想这不是我需要排除的文件夹,因为排除它不会阻止它为我创建.d.ts文件.我正在使用visual studio代码.我需要排除哪个文件?

Fid*_*kaj 14

如果你想要的是什么不产生d.ts文件,那么你需要删除:

declaration: true
Run Code Online (Sandbox Code Playgroud)

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

编译器选项doc中所指定

--declaration -d生成相应的'.d.ts'文件.