Is there a plugin (like for Gulp) where I can parse a typescript file and read out single parts (like a member, a function, comments), etc.
So that I have a class like this in let's say ./src/Foo.ts
:
class Foo {
static name: string = 'name';
/**
* This is a comment
*/
private bar: string;
/**
* This is also a comment
*/
public getBar(): string {
return this.bar;
}
}
What I want to do in TypeScript or JavaScript (inside a gulp plugin) is to read out this file, parse it and then have access to the member of this class.
Pseudocode:
var classTree = tsloader.parse('./src/Foo.ts');
var c = classTree.getClass(); // Returns a class object tree
for(var i = 0; i < c.getMembers().length; i++) {
c.getMembers()[i].getType(); // Returns the type
c.getMembers()[i].getComment(); // Returns the comment
// etc.
}
// etc.
Is there any library or something that is already capable of doing this?