@tokland/ts-file-parser
v0.0.23
Published
This repository provides a parser for `*.ts` files. It parses the structure of a file and provides JSON object that contains its declaration.
Downloads
2
Readme
TypeScript File Parser
Parse ts
files and convert them to JSON objects.
Usage
import tsFileStruct from "ts-file-parser";
const filePath = "./src/typescript-file.ts";
const decls = fs.readFileSync(filePath).toString();
const jsonStructure = tsFileStruct.parseStruct(decls, {}, filePath);