Hi,
I want to know how to traverse a AST tree?
I want to visit any node and find each comment.
Something like walk-parse5
walk(documentOrNode, node => {
if (node['type'] && node['type'] === 'comment') {
var data = <string>node['data'];
}
});
Hey @HamedFathi,
See this page: https://dsherret.github.io/ts-morph/navigation/
I think you're probably look for either the forEachChild or forEachDescendant method.
Most helpful comment
Hey @HamedFathi,
See this page: https://dsherret.github.io/ts-morph/navigation/
I think you're probably look for either the
forEachChildorforEachDescendantmethod.