Tools and guide for documenting TypeScript code?

user797257 picture user797257 · Apr 28, 2013 · Viewed 35.7k times · Source

Are there any tools for generating documentation for TypeScript source code? Or should I use something generic like NaturalDocs? What would be the recommended style of the block comments / those intended for standalone volume of documentation.

Should I use:

///<foo>bar</foo> MSVS kind of comments?

or

/** @javadoc style comments */

or perhaps

/*
  Something like this?
 */

I'm afraid to use /// because it is used for imports, and I don't want to tread on some other future feature possibly introduced in the similar way - but you never know...

Or is it possible to generate documented JavaScript from TypeScript and then use the JavaScript toolchain?

Answer

sebastian-lenz picture sebastian-lenz · Jun 2, 2014

I have just released a tool called TypeDoc that generates html api documentation pages out of TypeScript *.ts files.

The documentation generator runs the TypeScript compiler and extracts the type information from the generated compiler symbols. Therefore you don't have to include any additional metadata within your comments.

If you want to try it out, simply install and run the tool through npm:

npm install typedoc --global
typedoc --out path/to/documentation/ path/to/typescript/project/

If you want to know what a documentation created with TypeDoc looks like, head over to the GitHub page of the project:

http://typedoc.org/ | https://github.com/TypeStrong/typedoc