ts-bookshelf is a library for generating markdown documentation from typescript types.
$ npm install ts-bookshelf # or $ yarn add ts-bookshelfand you should install and import reflect-metadata and configure related things in your project:
$ npm install reflect-metadata # or $ yarn add reflect-metadataimport "reflect-metadata";// in your tsconfig.json { compilerOptions: { emitDecoratorMetadata: true, experimentalDecorators: true, }, }import "reflect-metadata"; import { DocField, DocType, generateDocsForClass } from "ts-bookshelf"; import * as fs from "fs"; @DocType({ name: "MyType", description: "this is a description of my type", }) class MyType { @DocField({ description: "this is a description", }) public myProperty!: string; } // ... const content = generateDocsForClass(MyType); fs.writeFileSync("docs-for-MyType.md", content);then docs-for-MyType.md will be:
# MyType (MyType) this is a description of my type ## Fields ### `myProperty` | Name | Description | | ----------- | --------------------- | | Type | String | | Nullable | β No | | Description | this is a description |