如何使用JSDOC3来记录枚举常量 [英] How To Use JSDOC3 To Document Enum Constants
本文介绍了如何使用JSDOC3来记录枚举常量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们正在使用JSDOC来记录我们面向客户端的SDK,我们很难认识到我们的枚举(即常量)。我们应该使用哪些标签来让JSDOC在文档中提取?以下是一个示例:
We're using JSDOC to document our client-facing SDK and we're having difficult getting it to recognize our 'enums' (i.e. constants). Which tags should we use to get JSDOC to pick it up in the documentation? Here's a sample:
/**
* @module Enum
*/
export namespace {
/**
* @enum WidgetType {string}
*/
Enum.WidgetType = {
/** Dashboard */
Dashboard: 'dashboard',
/** Form */
Form: 'entityeditform',
/** Report */
Report: 'report'
};
}
以下是代码中使用枚举的方式:
Here's how the 'enums' are used in code:
app.widget({ id: 'account_entityform', type: Enum.WidgetType.Form }).add();
我们如何使用JSDOC记录?
How can we document this with JSDOC?
推荐答案
在查看 StackOverflow 这篇文章后,我能够使用以下内容:
After reviewing this article on StackOverflow I was able to get this working using the following:
/**
* @typedef FieldType
* @property {string} Text "text"
* @property {string} Date "date"
* @property {string} DateTime "datetime"
* @property {string} Number "number"
* @property {string} Currency "currency"
* @property {string} CheckBox "checkbox"
* @property {string} ComboBox "combobox"
* @property {string} Dropdownlist "dropdownlist"
* @property {string} Label "label"
* @property {string} TextArea "textarea"
* @property {string} JsonEditor "jsoneditor"
* @property {string} NoteEditor "noteeditor"
* @property {string} ScriptEditor "scripteditor"
* @property {string} SqlEditor "sqleditor"
*/
这篇关于如何使用JSDOC3来记录枚举常量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文