Alvaro Dias

New TypeDocs release with website generation

TypeDocs is a library that generates API documentation for your TypeScript code. One of the cool features it provides is automatically correlating JsDocs in code with the associated type of the code entity.

Check out the documentation generated by this project here: https://typedocs.azurewebsites.net/

I started this project over 2 years back, however hadn't spent as much time on it as I would have liked. I've recently revived it over the past few weekends and updated it to support the new TypeScript 2.0 release.

It is available as an NPM package (https://www.npmjs.com/package/typedocs) by running the following command:

npm install typedocs

There's primary two ways for consuming this library.

  1. If you want to access documentation programmatically, you can use the below snippet to get documentation for your TS code.
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);
  1. If you want to access directly, you can simply generate a static website.
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.",
        }
    }
});

More details here: https://github.com/alvarorahul/TypeDocs/blob/master/README.md

I'd love to further enhance the website generation capabilities, including among other things, I'd like to add multiple themes that users can choose from, ability to specify custom markdown for various known elements, etc.

I'm accepting contributions to the project. Please read the contribution guide here: https://github.com/alvarorahul/TypeDocs/blob/master/Contributing.md