TsSimpleAst
JS Docs
Certain nodes in TypeScript can have JS docs. For example:
/**
* Gets the name.
*/
function getName() {
// ...
}
Get string
Use getDocumentationComment() to return all the documentation comments separated by new lines as a string:
functionDeclaration.getDocumentationComment(); // returns: string | undefined
This will return undefined if no documentation comment exists.
Get all documentation comment nodes
You can get all the documentation comment nodes by using getDocumentationCommentNodes():
functionDeclaration.getDocumentationCommentNodes(); // returns: JSDoc[]