Kir*_*and 11 javascript jsdoc jsdoc3
对于像这样的功能......
function example() {
var X = 100;
...
var Y = 'abc';
...
return Z;
}
Run Code Online (Sandbox Code Playgroud)
我需要解释一些局部变量的用途.添加这样的描述......
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;
}
Run Code Online (Sandbox Code Playgroud)
...似乎没有被接受JS Doc v3.4.0.
什么是正确的语法?
PS我的一些用例需要多行注释.
mas*_*ash 21
我通常在我的项目中使用类似下面的代码.
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;
}
Run Code Online (Sandbox Code Playgroud)
vit*_*ytv 15
一个班轮:
/** @type {string} */
var Y = 'abc';
Run Code Online (Sandbox Code Playgroud)
似乎JS Docs会忽略“块”中的注释(例如,类,函数等)。我试过了...
@description
@inner
@instance
@member
@memberof
@name
@summary
Run Code Online (Sandbox Code Playgroud)
...和别的。我无法让他们任何人生成文档。在整个JS Doc示例中,他们使用普通的JS注释进行此类操作。
我的结论是,对此没有官方的JS Doc语法。