BeniaminoBaggins
BeniaminoBaggins

Reputation: 12433

stop typescript compiler from creating .d.ts files

I want typescript to not create .d.ts files when compiling. This is because it causes a "duplicate Identifier" error on all class names. I have 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 make it stop creating .d.ts files as shown in this answer

But I guess that is not the folder that I need to exclude because excluding it doesn't stop it creating .d.ts files for me. I am using visual studio code. What file do I need to exclude?

Upvotes: 16

Views: 8342

Answers (1)

Fidan Hakaj
Fidan Hakaj

Reputation: 7163

If what you want is not to generate the d.tsfiles, then you need to remove:

declaration: true

from your compiler options in tsconfig.json

As specified in the compiler options doc

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

Upvotes: 31

Related Questions