Stop typescript compiler from creating .d.ts files

I want typescript not to create .d.ts files at compilation. This is because it causes an "duplicate identifier" error for all class names. I added this to the tsconfig file:

{ "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 ] } 

This is supposed to stop creating .d.ts files as shown in this answer

But I think that this is not the folder that I need to exclude, because excluding it does not stop it from creating .d.ts files for me. I am using visual studio code. Which file do I need to exclude?

+5
source share
1 answer

If you need to not generate d.ts files, you need to delete :

 declaration: true 

from your compiler options in tsconfig.json

As indicated in the doc compiler options

- Declaration -d Creates the corresponding .d.ts file.

+12
source

Source: https://habr.com/ru/post/1245373/


All Articles