How can I declare that company
is a String in this code snippet using JSDoc?
fetch('https://api.github.com/users/mdo').then(res => res.json()).then(res => {
console.log(res.company);
});
When I use WebStorm, it shows company
as an Unresolved variable
:
https://i.sstatic.net/gn1kb.png
If I add
/** @namespace bogus.company **/
anywhere in the file, WebStorm accepts it, but it seems odd:
https://i.sstatic.net/lxT3X.png
Is this a bug in WebStorm, or am I misunderstanding how JSDoc declarations should be used?
Should JSDoc even be used for this scenario?