2016-05-17 81 views
3

有没有人有建议我应该为Angular2应用程序记录我的TypeScript代码?我正在寻找一个可以从文档代码生成文档页面的工具。Documenting Angular2 TypeScript代码

我试着用TypeDoc做,但它似乎并没有工作到目前为止,并给我很多错误。

如果有人有这方面的经验,任何建议将有所帮助。

更新:

我一直在试图用TypeDoc生成文档。 这是我运行命令:

typedoc --experimentalDecorators --out 'doc/' 'app/' --excludeExternals --target 'es5' -module 'commonjs' 

这里就是我得到:

Using TypeScript 1.8.10 from /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/typescript/lib 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/attributedirectives/slide-ng-if.directive.ts(17) 
Cannot find name 'jQuery'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/attributedirectives/slide-ng-if.directive.ts(20) 
Cannot find name 'jQuery'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/attributedirectives/slide-ng-if.directive.ts(21) 
Cannot find name 'jQuery'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/attributedirectives/slide-ng-if.directive.ts(22) 
Cannot find name 'jQuery'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/components/dashboard/dashboard.component.ts(88) 
Cannot find name 'IGridstackOptions'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/components/dashboard/dashboard.component.ts(107) 
Cannot find name 'jQuery'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/components/dashboard/dashboard.component.ts(109) 
Cannot find name 'jQuery'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/components/dashboard/dashboard.component.ts(115) 
Cannot find name 'jQuery'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/components/dashboard/widgets/goalwidget.component.ts(3) 
Module '"/Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/models/goal"' has no exported member 'Unit'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/components/dashboard/widgets/risk-score-widget.component.ts(2) 
Cannot find namespace 'moment'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/components/dashboard/widgets/risk-score-widget.component.ts(54) 
Cannot find name 'jQuery'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/components/dashboard/widgets/risk-score-widget.component.ts(55) 
Cannot find name 'Chart'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/components/dashboard/widgets/risk-score-widget.component.ts(72) 
Cannot find name 'moment'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/components/gridstack/gridstack.component.ts(36) 
Cannot find name 'IGridstackOptions'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/components/gridstack/gridstack.component.ts(56) 
Cannot find name 'jQuery'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/components/gridstack/gridstack.component.ts(58) 
Cannot find name 'jQuery'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/components/navigation/sidebarmenu.component.ts(80) 
Property 'startsWith' does not exist on type 'string'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/components/user/role-selector.component.ts(34) 
Cannot find name 'jQuery'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/pipes/display-notation.pipe.ts(2) 
Module '"/Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/models/goal"' has no exported member 'Unit'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/pipes/moment.pipe.ts(5) 
Cannot find name 'moment'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/services/implementations/mock/mock-score-service.ts(2) 
Cannot find namespace 'moment'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/services/implementations/mock/mock-score-service.ts(14) 
Cannot find name 'moment'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/util/mobileDetector.ts(3) 
Cannot find name 'MobileDetect'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/app/util/mobileDetector.ts(6) 
Cannot find name 'MobileDetect'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/platform/browser.d.ts(77) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/core/application_ref.d.ts(38) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/core/application_ref.d.ts(92) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/core/application_ref.d.ts(151) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/core/change_detection/differs/default_keyvalue_differ.d.ts(22) 
Cannot find name 'Map'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/core/change_detection/differs/default_keyvalue_differ.d.ts(24) 
Cannot find name 'Map'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/core/di/reflective_provider.d.ts(102) 
Cannot find name 'Map'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/core/di/reflective_provider.d.ts(102) 
Cannot find name 'Map'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/core/linker/component_resolver.d.ts(7) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/core/linker/component_resolver.d.ts(11) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts(58) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts(99) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts(104) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts(105) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/async.d.ts(26) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/async.d.ts(27) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/collection.d.ts(0) 
Cannot find name 'MapConstructor'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/collection.d.ts(1) 
Cannot find name 'SetConstructor'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/collection.d.ts(3) 
Cannot find name 'Map'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/collection.d.ts(3) 
Cannot find name 'Map'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/collection.d.ts(6) 
Cannot find name 'Map'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/collection.d.ts(7) 
Cannot find name 'Map'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/collection.d.ts(10) 
Cannot find name 'Map'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/collection.d.ts(11) 
Cannot find name 'Map'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/collection.d.ts(13) 
Cannot find name 'Map'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/collection.d.ts(14) 
Cannot find name 'Map'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/collection.d.ts(99) 
Cannot find name 'Set'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/collection.d.ts(100) 
Cannot find name 'Set'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/collection.d.ts(101) 
Cannot find name 'Set'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/lang.d.ts(3) 
Cannot find name 'Map'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/lang.d.ts(4) 
Cannot find name 'Set'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/lang.d.ts(70) 
Cannot find name 'Map'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/promise.d.ts(1) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/promise.d.ts(7) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/promise.d.ts(8) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/promise.d.ts(9) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/promise.d.ts(9) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/promise.d.ts(10) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/promise.d.ts(10) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/promise.d.ts(11) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/promise.d.ts(11) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/facade/promise.d.ts(12) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/platform/browser/browser_adapter.d.ts(74) 
Cannot find name 'Map'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/platform/dom/dom_adapter.d.ts(84) 
Cannot find name 'Map'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/directives/router_outlet.d.ts(26) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/directives/router_outlet.d.ts(32) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/directives/router_outlet.d.ts(37) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/directives/router_outlet.d.ts(46) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/directives/router_outlet.d.ts(57) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/instruction.d.ts(123) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/instruction.d.ts(147) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/instruction.d.ts(163) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/instruction.d.ts(166) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/interfaces.d.ts(20) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/interfaces.d.ts(38) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/interfaces.d.ts(56) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/interfaces.d.ts(79) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/interfaces.d.ts(101) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/lifecycle/lifecycle_annotations.d.ts(28) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/route_config/route_config_impl.d.ts(100) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/route_definition.d.ts(19) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/route_definition.d.ts(34) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/route_registry.d.ts(51) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/router.d.ts(55) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/router.d.ts(67) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/router.d.ts(85) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/router.d.ts(98) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/router.d.ts(106) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/router.d.ts(111) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/router.d.ts(119) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/router.d.ts(127) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/router.d.ts(131) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/router.d.ts(137) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/angular2/src/router/router.d.ts(145) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/CoreOperators.d.ts(34) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/CoreOperators.d.ts(49) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/CoreOperators.d.ts(88) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/CoreOperators.d.ts(93) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/CoreOperators.d.ts(93) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/Observable.d.ts(45) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/Observable.d.ts(46) 
Cannot find name 'Iterator'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/Observable.d.ts(102) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/Observable.d.ts(102) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/Observable.d.ts(142) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/Observable.d.ts(157) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/Observable.d.ts(200) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/Observable.d.ts(205) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/Observable.d.ts(205) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/observable/ForkJoinObservable.d.ts(5) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/observable/ForkJoinObservable.d.ts(6) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/observable/FromObservable.d.ts(6) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/observable/FromObservable.d.ts(6) 
Cannot find name 'Iterator'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/observable/PromiseObservable.d.ts(8) 
Cannot find name 'Promise'. 
Error: /Users/bertwillekens/Desktop/dashboard/src/main/webapp/WEB-INF/node_modules/rxjs/observable/PromiseObservable.d.ts(9) 
Cannot find name 'Promise'.  
+0

我已经更新了一些更详细的职位。谢谢! –

+0

你可以先用includeDeclarations来尝试,如果它不起作用,那么检查ignoreCompilerErrors是否有效,至少是有一些输出。 –

+0

ignoreCompilerErrors更改了某些内容,现在生成了docs,但除了名为Globals的空子部分外,它们是空的。 includeDeclarations似乎没有任何效果。 –

回答

3

添加咕嘟咕嘟任务创建typedoc。

var gulp = require("gulp"), 
    typedoc = require("gulp-typedoc"); 

gulp.task("typedoc", function() { 
var srcTSFiles= [<All src Typescript files>]; 

return gulp 
    .src(srcTSFiles) 
    .pipe(typedoc({ 
     // TypeScript options (see typescript docs) 
     module: "commonjs", 
     target: "ES5", 
     includeDeclarations: true, 
     emitDecoratorMetadata: true, 
     experimentalDecorators: true, 

     // Output options (see typedoc docs) 
     out: "dist/doc", 
     json: "dist/to/file.json", 

     // TypeDoc options (see typedoc docs) 
     name: "project-name", 
     version: true, 
     noLib: true 
    })); 
    }); 

希望这有助于!

+1

我不认为'noLib'选项已被支持。 TypeError:无法读取未定义的属性'标志' – david

0

错误的原因是,“时刻”,“jQuery”和其他库的打字定义不可用。您可以为类型定义管理器(“https://www.npmjs.com/package/typings”)中的那些人安装类型定义并尝试。

类型定义管理器不具有类型定义,所有的JavaScript库,在这种情况下,你可以忽略通过将“--ignoreCompilerErrors”在指令编译typedoc的错误,如下

typedoc - -experimentalDecorators --out 'doc /' 下 '应用程序/' --excludeExternals --target 'ES5' - 模块 'CommonJS的' --ignoreCompilerErrors

这是preferrable将所有的文档生成配置typedoc.json和使用相同的文件生成文档,您可以使用--json标志挑从文件中的配置,下面 是用于从文件读取配置(typedoc.json是typedoc配置文件)

“typedoc --options ./typedoc.json --ignoreCompilerErrors ./src样品评论/我tsconfig.json文件

{ 
    "mode": "modules", 
    "out": "./dist/lib", 
    "json": "./dist/lib/api.json", 
    "theme": "default", 
    "experimentalDecorators": "true", 
    "emitDecoratorMetadata": "true", 
    "excludePrivate": "true", 
    "excludeExternals": "true", 
    "externalPattern":"./**.*!./src/**.*", 
    "includeDeclarations": "true", 
    "target": "es6", 
    "exclude": "**/+(*.spec.ts|*.scss|*.html|demo/**|node_modules/**/*.*|e2e/*.*|src/demo/**/*.*)", 
    "name": "ui-common-shared", 
    "moduleResolution": "node", 
    "preserveConstEnums": "true", 
    "stripInternal": "true", 
    "suppressExcessPropertyErrors": "true", 
    "suppressImplicitAnyIndexErrors": "true", 
    "module": "commonjs" 
} 

的LIB /”

样品欲了解更多信息请参阅:https://github.com/angular/material2/blob/master/GENERATING_API_DOCS.md