Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeDoc can not find Angular2 modules

I am trying to generate doc files by using TypeDoc. When I run TypeDoc with the follwing command:

/node_modules/.bin/typedoc --module system --target ES5 --exclude *.spec.ts* --experimentalDecorators --out typedoc app/ --ignoreCompilerErrors

It gives as output:

Using TypeScript 1.6.2 from /development/node_modules/typedoc/node_modules/typescript/lib
Error: /development/app/angular2/app.ts(1)
 Cannot find module 'angular2/core'.
Error: /development/app/angular2/app.ts(2)
 Cannot find module 'angular2/upgrade'.
Error: /development/app/angular2/app.ts(3)
 Cannot find module 'angular2/platform/browser'.
Error: /development/app/angular2/app.ts(5)

tsconfig.json

{
  "compilerOptions": {
    "target": "ES5",
    "module": "system",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules"
  ]
}

Is there some kind of parameter I am missing here to include the libs or .d.ts. files?

like image 610
Bas van Dijk Avatar asked Jan 26 '16 14:01

Bas van Dijk


2 Answers

I tried with the commonjs module and it worked.

typedoc --experimentalDecorators --target 'es5' --module 'commonjs' --out doc-destination/ src/
like image 59
Louis-Philippe Monette Avatar answered Oct 21 '22 18:10

Louis-Philippe Monette


I use typedoc with angular2 application. Although I run it through gulp-typedoc the passed parameters should be the same. The following gulp task does the job for me:

gulp.task("doc", function() {
    return gulp
        .src(["./myproject/**/*.ts"])
        .pipe(typedoc({ 
            // TypeScript options (see typescript docs) 
            module: "commonjs", 
            target: "es5",
            includeDeclarations: false,
            experimentalDecorators: true,

            // Output options (see typedoc docs) 
            out: "./docs", 

            // TypeDoc options (see typedoc docs) 
            name: "MyProject", 
            ignoreCompilerErrors: false,
            excludeExternals:true,
            version: true,
        }));
});

Hope this helps.

like image 1
Amid Avatar answered Oct 21 '22 18:10

Amid