Installation

Command line interface

Requirements

TypeDoc requires Node.js to be installed on your system. If you haven’t done that already, head over to their site and follow their install instructions:

http://nodejs.org/

Installing TypeDoc is pretty easy as it is available as a node package. Using npm ensures that all relevant dependencies are setup correctly. Just decide whether you want a global or local setup.

Global installation

If you want to directly use TypeDoc, this is the preferred way of installing it:

$ npm install --global typedoc

Like the TypeScript compiler, TypeDoc comes with a binary that can be called from anywhere if you install TypeDoc as a global module. The name of the executable is typedoc. To verify everything is setup correctly, you can run TypeDoc with no arguments. It should output some help messages:

$ typedoc

Version 0.1.0
Syntax:   typedoc [options] [file ..]

Examples: typedoc --out ../doc/ hello.ts

Local installation

If you want to use TypeDoc as a module within your project, e.g. to integrate it with your build process, you can also install it as a local module.

$ npm install --save-dev typedoc

Within your modules you can access it by requiring typedoc:

var typedoc = require('typedoc');
var app = new typedoc.Application();

Head over to our api documentation to learn more about the exposed api.

Task runners

Some great folks out there have created plugins so you can run TypeDoc with your favorite task runner. There are plugins available for Grunt and Gulp, both of them can be easily installed using npm. Both plugins accept the same options as the cli application, see usage.

Grunt

Name
grunt-typedoc
Website
https://www.npmjs.org/package/grunt-typedoc/
Author
[Bart van der Schoor](https://github.com/Bartvds)

You can install the plugin with the following command:

$ npm install --save-dev grunt-typedoc

Update the following snippet with your configuration and add it to your gruntfile.js file:

grunt.loadNpmTasks('grunt-typedoc');
grunt.initConfig({
    typedoc: {
        build: {
            options: {
                module: 'commonjs',
                target: 'es5',
                out: 'docs/',
                name: 'My project title'
            },
            src: 'src/**/*'
        }
    }
});

Gulp

Name
gulp-typedoc
Website
https://www.npmjs.org/package/gulp-typedoc/
Author
[Rogier Schouten](https://github.com/rogierschouten)

You can install the plugin with the following command:

$ npm install --save-dev gulp-typedoc

Update the following snippet with your configuration and add it to your gulpfile.js file:

var typedoc = require("gulp-typedoc");
gulp.task("typedoc", function() {
    return gulp
        .src(["src/**/*.ts"])
        .pipe(typedoc({
            module: "commonjs",
            target: "es5",
            out: "docs/",
            name: "My project title"
        }))
    ;
});