如何生成 TypeScript UML 类图?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46241700/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 04:53:46  来源:igfitidea点击:

How to generate TypeScript UML class diagrams?

visual-studiotypescriptuml

提问by Mhd

I'm using Visual Studio 2015 to create Web Apps and I just start using TypeScript.

我正在使用 Visual Studio 2015 来创建 Web 应用程序,我刚刚开始使用TypeScript.

As my project gets bigger, I'm wondering if there's a way to get UML diagram of TypeScriptcode using Visual Studio, extensions or any other free tool.

随着我的项目越来越大,我想知道是否有办法TypeScript使用 Visual Studio、扩展或任何其他免费工具获取代码的UML 图。

回答by Breck

Using TsUML:

使用TsUML

npm install -g tsuml
# Note: this posts data to https://yuml.me!!
tsuml --glob ./src/**/*.ts

回答by zmf

You can try tplant.

你可以试试tplant

Another alternative, which I currently use but requires VSCode, is: vscode-ts-uml

我目前使用但需要 VSCode 的另一种选择是:vscode-ts-uml

回答by zmf

for Visual Studio : https://marketplace.visualstudio.com/items?itemName=AzadRatzki.TypeScriptDiagram#overview

对于 Visual Studio:https: //marketplace.visualstudio.com/items?itemName=AzadRatzki.TypeScriptDiagram#overview

for vscode : https://github.com/remojansen/TsUML

对于 vscode:https: //github.com/remojansen/TsUML

or

或者

I would suggest commenting your TypeScript code using the JSDoc convention, compile your TS code without stripping off comments (removeComments to false in tsconfig.json), and use a documentation generator on the JS files.

我建议使用 JSDoc 约定注释您的 TypeScript 代码,编译您的 TS 代码而不剥离注释(在 tsconfig.json 中将注释删除为 false),并在 JS 文件上使用文档生成器。

Based on that, you could maybe find a tool to generate UML diagram from JSDoc : JSDoc UML Diagram

基于此,您可能会找到一个从 JSDoc 生成 UML 图的工具:JSDoc UML Diagram