JSDoc type name collision - autocomplete chooses wrong type - how to coerce to right type?

In our JavaScript Node.js project, we may have multiple classes named the same in different files (and classes named the same that may not be generated by us but in libraries).

Without JSDoc, WebStorm's autocomplete might not be able to suggest properties and methods for a variable.  However, with JSDoc annotations, we are able to specify a variable's type via @param, @property, @type, etc...  However, there are times when we specify, for example, @param {User} user, but WebStorm chooses the wrong User, if the class User has multiple definitions in multiple files.  How can we properly "namespace" or classify the proper User so the type hinting works for WebStorm's autocomplete?

0
1 comment

You can probably use @namespace and @memberOf - see http://usejsdoc.org/tags-memberof.html - and then use the qualified name in JSDoc annotation when referring to your class

0

Please sign in to leave a comment.