Open mortalYoung opened 5 months ago
This works for me
const code = `
/**
* This is test
*/
export const test = {
/**
* This is a
*/
a: 1,
/**
* This is b
*/
b: 2,
};
`;
const project = new Project();
const sourceFile = project.createSourceFile("", code);
sourceFile.forEachDescendant((node) => {
if (Node.isVariableStatement(node)) {
const docs = node.getJsDocs();
for (const doc of docs) {
console.log(doc.getCommentText());
}
}
});
I could find JSDoc node from ast. But when I can't get it by getJsDoc.
https://ts-ast-viewer.com/#code/PQKhCgAIUgVALAlgZ0iyAXApsjUTDhYAeADgPYBOGkAxuQHa6Y40C8kA3lJL6BL0EwE6dAEMeQwoMhiAXJACMAGkmR+a6HCSp0AI00E1ehQCZVAXwDc4IA
I don't know it's a feature or bug?