2016-05-17 77 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