[英]jsdoc two dimensional array
I have an array of array of string and I can't figure out how to document that with JSDoc.我有一个字符串数组,我不知道如何用 JSDoc 记录它。
/**
@class
*/
function PostbackList() {
/**
@type {int}
@default
*/
this.TypeID = 0;
/**
@type {PostbackList.Field[]}
*/
this.Fields = new Array();
/**
!! Issue here !!
@type {string[][]}
*/
this.Values = null;
}
Which results in errors.这会导致错误。
Invalid type expression "string[][]": Expected "!", "?"无效的类型表达式“string[][]”:应为“!”、“?” or "|"或“|” but "[" found.但是找到了“[”。
And I don't know if I should put ?
而且不知道该不该放?
in front of the type to indicate it can be null.在类型前面表示它可以为空。
According to what the current maintainer of jsdoc says in this issue report , as we speak jsdoc 3 cannot handle declaring multidimensional arrays by adding square brackets.根据当前 jsdoc 维护者在此问题报告中所说的,正如我们所说,jsdoc 3 无法通过添加方括号来处理声明多维数组。 You can do it like you did with Array.<string[]>
, or with Array.<Array.<string>>
.您可以像使用Array.<string[]>
或使用Array.<Array.<string>>
。
According to the issue report, version 3.3.0 will allow the notation you wanted to use.根据问题报告,版本 3.3.0 将允许您想要使用的符号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.