Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tool to generate documentation from JSDoc on TypeScript interfaces

I have a .d.ts file with the interfaces describing my library. It has JSDoc comments, which will be shown via intellisense in Visual Studio when people refer to the .d.ts in their code:

/** Description of JSNLogAppender */
interface JSNLogAppender {
    /* Description of setOptions */
    setOptions(options: JSNLogAppenderOptions): void;

    /* Description of log */
    log(logItem: JSNLogItem): void;
}

... etc ...

I need to generate documentation based on the JSDoc and TypeScript interfaces. Problem is that the generators I found all work with JavaScript, and interfaces are not compiled to JavaScript. I could put the JSDoc on the actual classes and functions that implement the interfaces, but than I would lose the intellisense when people refer to the .d.ts file.

Is there a tool that generates html documentation from the JSDoc comments and the TypeScript interface definitions in a .d.ts file?

like image 821
user1147862 Avatar asked May 19 '13 15:05

user1147862


2 Answers

You can use http://typedoc.org/

It supports jsdoc for things it cannot infer http://typedoc.org/guides/doccomments/

And any jsdoc descriptor it doesn't recognise will still be outputted, which is fortunate.

like image 84
balupton Avatar answered Oct 03 '22 13:10

balupton


I found a npm module that claims to do this, though I haven't tried it yet: https://www.npmjs.org/package/tsdoc

like image 21
JasonS Avatar answered Oct 03 '22 15:10

JasonS