typedocs
v0.6.7
Published
A library that generates JSON documentation for TypeScript code by correlating the TypeScript typing with JsDocs comments.
Downloads
398
Maintainers
Readme
TypeDocs
TypeDocs is a library that helps generate API documentation for TypeScript code.
Installing
npm install typedocs
Usage
To get documentation programmatically, you can invoke this library programmatically as follows: -
import * as typedocs from "typedocs";
"use strict";
const sourceFileName = "path/to/declaration.d.ts";
// Generate documentation by calling the generate function
// passing in the definition files.
const result = typedocs.generate([sourceFileName]);
// Optionally you can flatten the modules to include
// separate items for nested modules.
const flatResult = typedocs.flattenModules(result);
To generate a docs website, execute the following: -
import * as typedocs from "typedocs";
"use strict";
const sourceFileName = "path/to/declaration.d.ts";
// Generate documentation by calling the generate function
// passing in the definition files.
const result = typedocs.generate([sourceFileName], {
websiteOptions: {
dir: "./myproductwebsite",
resources: {
productName: "My awesome product",
productDescription: "The description for my awesome product.",
}
}
});
Sample
The samples folder contains an app that demonstrates the usage above. You can run the below command to exercise it.
node sampleapp.js
Contributing
To contribute to the project please go through the Contributing.md guide.