Skip to content Skip to sidebar Skip to footer

Get Typescript Class In A File And Read Single Parts Of It

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'

Solution 1:

Jed mao has an excellent (but under appreciated) project that open's up the TypeScipt compiler api for commonjs consumption : https://www.npmjs.org/package/typescript-api

It ships with a definition file : https://github.com/jedmao/typescript-api/blob/master/typescript-api.d.ts

The logic inside it is blatantly simple : https://github.com/jedmao/typescript-api/blob/master/wrapper.js#L15-L28 it bascially just opens up tsc.js with a module.exports = TypeScript;

Usage

You will basically need to investigate how TypeScript does its work. But PullTypeSymbol which has public getMembers(): PullSymbol[]; seems to be in the worth searching in the TypeScript Source code (https://typescript.codeplex.com/)

Post a Comment for "Get Typescript Class In A File And Read Single Parts Of It"