Jeremy
Jeremy

Reputation: 377

Generating Typescript Definition File (d.ts) without compiling .js

I'm generating d.ts files from ts files. However, I see no way to prevent the generation of the .js files while doing this.

The command i am using is:

tsc --declaration test.ts

This generated both a test.d.ts as a test.js. However I only want it to generate a test.d.ts file.

Are there any options to do so?

Upvotes: 0

Views: 1129

Answers (2)

Jason Jarrett
Jason Jarrett

Reputation: 3987

One option would be to use the --out otherFile.js parameter and just discard/ignore what was generated.

So your command could look like:

tsc --declaration test.ts --out ignoreMe.js

Hope this helps.

Upvotes: 0

Fenton
Fenton

Reputation: 250922

There is no flag you can pass to the compiler at the current time that will prevent it from creating the JavaScript file. The main purpose of the compiler is to create the JavaScript and the additional features like d.ts files and source maps are in addition to that core feature.

There is no harm asking for this as an enhancement over at http://typescript.codeplex.com/workitem/list/basic

Upvotes: 1

Related Questions