Javascript 局部变量的正确JSDoc语法是什么?
对于这样的函数Javascript 局部变量的正确JSDoc语法是什么?,javascript,jsdoc,jsdoc3,Javascript,Jsdoc,Jsdoc3,对于这样的函数 function example() { var X = 100; ... var Y = 'abc'; ... return Z; } function example() { /** * @description - Need to explain the purpose of X here. */ var X = 100; ... /** * @description - Need to explain t
function example() {
var X = 100;
...
var Y = 'abc';
...
return Z;
}
function example() {
/**
* @description - Need to explain the purpose of X here.
*/
var X = 100;
...
/**
* @description - Need to explain the purpose of Y here.
*/
var Y = 'abc';
...
return Z;
}
我需要解释一些局部变量的用途。添加这样的描述
function example() {
var X = 100;
...
var Y = 'abc';
...
return Z;
}
function example() {
/**
* @description - Need to explain the purpose of X here.
*/
var X = 100;
...
/**
* @description - Need to explain the purpose of Y here.
*/
var Y = 'abc';
...
return Z;
}
…似乎没有被JS Doc v3.4.0
接受
正确的语法是什么
另外,我的一些用例需要多行注释。我通常在我的项目中使用类似下面的代码
function example() {
/**
* Need to explain the purpose of X here.
* @type {number}
*/
var X = 100;
...
/**
* Need to explain the purpose of Y here.
* @type {string}
*/
var Y = 'abc';
...
return Z;
}
JS文档似乎忽略了“块”中的注释(例如类、函数等)。我试过
@description
@inner
@instance
@member
@memberof
@name
@summary
…和其他人。我无法让他们中的任何人生成文档。在整个JS文档示例中,他们使用普通的JS注释来处理这类事情
我的结论是,没有正式的JS文档语法。一行:
/** @type {string} */
var Y = 'abc';
对我来说最好的事情是:
/**
* @name AssetAutoGenerationOption
* @type {"all" | "master" | "off"}
*/
export type AssetAutoGenerationOption = "all" | "master" | "off";
作为旁注。。当回答一个老问题时,解释你的答案所针对的问题的新方面是很有用的。此答案没有说明已接受答案中所说的任何内容,也没有表明随着时间的推移,情况是否因新版本软件的出现而发生了变化。此答案应标记为正确答案。要回答@vitaliytv并扩展答案,是的,jsdoc似乎已经扩展了对内部成员的支持。这对我有用。