有没有一种方法可以内联对象键而不是全部在一个块中编写复杂对象的typedef?例如,根据JSDoc文档https://jsdoc.app/tags-property.html,可以这样做:
Private Sub Workbook_Open()
Call Notes.OpenForm
End Sub
Private Sub SendETSNote_Click()
Call Notes.OpenForm
End Sub
Sub Done_Click()
'
' Upon document close, shut down Outlook if running and started within this code
'
If outlookRunning = True Then
'If we started Outlook from within this code, then close it
oOutlookApp.Quit
End If
'
' Turn off screen updating so user doesn't see resizing
' Resize Excel sheet to max before closing
' Close without saving changes
'
Application.ScreenUpdating = False
Application.WindowState = xlMaximized
ActiveWindow.WindowState = xlMaximized
'
' Close the form
'
Unload Me
ThisWorkbook.Activate
Application.ScreenUpdating = True
ThisWorkbook.Saved = True
ThisWorkbook.Close False
Exit Sub
End Sub
成为这个:
/**
* Config type definition
* @typedef {Object} Config
* @property {string} prop1
* @property {string} [prop2]
*/
let Config = {
prop1: 'value1',
prop2: 'value2',
};
我尝试了各种标签组合,例如@ namespace,@ typedef,@ member,@ memberof等,但是当在一个JSDoc块中声明所有属性时,我无法获得漂亮的属性表通过尝试使用内联格式的标签的任意组合。
可以在一个块中定义typedef,直到您尝试定义一个跨越数百行的巨大配置对象。必须跳转到文件顶部以找到该键的属性描述,非常麻烦。