Typescript – Generate one declaration file for TypeScript library


I developed a library, which also contains TypeScript files, in Visual Studio 2013. The files are compiling correctly to JS files (AMD).

What I want is to create a single declaration file for this lib, but this does not work:

tsc --declaration --module AMD --out out.d.ts [files.ts]

Can someone please lead me to the right path?

TypeScript is used.

Best Solution

Its because you are providing .d.ts to out which will overwrite the declaration file with js contents. Also, you need to remove module amd because that works on per file basis (not --out friendly, see http://www.youtube.com/watch?v=KDrWLMUY0R0&hd=1)

So, try:

tsc [files.ts] --declaration --out out.js

which will generate out.d.ts

Related Question