I’m trying to document my code with JSDoc (EcmaScript 2015, WebStorm 12 Build 144.3357.8).
I have an arrow function which I want to document its parameters. This two examples work (I get auto-completion):
JavaScript
x
8
1
/** @param {Number} num1*/
2
var a = num1 => num1 * num1;
3
//------------------------------
4
/** @param {Number} num1*/
5
var a = num1 => {
6
return num1 * num1;
7
};
8
But when I want to document an arrow function in forEach
function, for example, the auto-completion isn’t working (all of the below):
JavaScript
1
14
14
1
/** @param {Number} num1*/
2
[].forEach(num1 => {
3
return num1 * num1;
4
});
5
//------------------------------
6
/** @param {Number} num1*/
7
[].forEach(num1 => num1 * num1);
8
//------------------------------
9
[].forEach(/** @param {Number} num1*/num1 => num1 * num1);
10
//------------------------------
11
[].forEach(/** @param {Number} num1*/num1 => {
12
return num1 * num1;
13
});
14
Has anyone managed to get this work?
Advertisement
Answer
Starting from the next EAP build, WebStorm will understand this:
JavaScript
1
4
1
[].forEach(/**Number*/num1 => {
2
return num1 * num1;
3
});
4
Please look at WEB-19280 for details.