There is another way to do this, even if it can be DEPRECATED . The emphasis is on maybe , because someone says that he is out of date (check the comments for this answer), while others say that one of them is in order. I am reporting this in any case for the sake of completeness.
Now take Promise.all() , for example, which returns a Promise executed with an array. Using the dot notation style, it will look like this:
{Promise.<Array.<*>>}
It works with JetBrains products (e.g. PhpStorm, WebStorm), and is also used in jsforce docs .
At the time of writing, when I try to auto-generate some documents using PHPStorm, it defaults to this style, although I found a bad link to it.
In any case, if you take the following function as an example:
// NOTE: async functions always return a Promise const test = async () => { let array1 = [], array2 = []; return {array1, array2}; };
When I let PhpStorm generate documents, I get the following:
const test = async () => { let array1 = [], array2 = []; return {array1, array2}; };
Francesco Casula Jun 23 '17 at 16:56 on 2017-06-23 16:56
source share