ts-code-info
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

TypeScript Code Info

Uses TypeScript compiler api to extract type info.

Extract info for:

  • modules
  • variables
  • types
  • functions
  • classes and class members

Extracts:

  • name
  • documentation
  • argumnets and return types
  • modifiers

Also provides typescript parser's nodes (ts.Node), types and symbols for each item.

Example: Flexible documentation generator

Check src/example.doc.ts file.

Example: Functions list

import { parse } from './index';
 
const funcs = parse([ './parsers.d.ts' ])
    .files['parsers.d.ts']
    .functions
    .map(f => f.name);
 
console.log(funcs);
/*
[ 'isNodeExported',
  'typeOfSymbol',
  'typeOfInfo',
  'symbolInfo',
  'parseSymbol',
  'parseVariable',
  'parseParameter',
  'parseSignature',
  'parseFunc',
  'parseTypeAlias',
  'parseClass',
  'parseClassMethod',
  'parseClassMember',
  'parseModuleBody',
  'parseModule',
  'parseSourceFile',
  'parseModifiers' ]
*/

Package Sidebar

Install

npm i ts-code-info

Weekly Downloads

1

Version

0.0.5

License

MIT

Last publish

Collaborators

  • morglod