Skip to content

Instantly share code, notes, and snippets.

@sallar sallar/
Created Nov 30, 2015

What would you like to do?
WebStorm AMD/JSDoc Problem

OK, So imagine you have this module which accepts another module as a parameter to one of it’s methods:

define("modules/module2", [], function() {

    return {
         * @param {module:myNamespace/module1} SomeModule
        somethingElse: function(SomeModule) {
            var instance = new SomeModule();


Notice that @param {module:myNamespace/module1} SomeModule is JSDoc’s recommended way of annotating module dependencies. But this is who it shows up in Webstorm:

Webstorm doesn’t recognize the module. But if I change the param definition to:

 * @param SomeModule {@type module:myNamespace/module1}

Webstorm starts recognizing it and offers autocomplete, etc. There is two changes: Parameter name is first, then after { I added @type to make sure webstorm knows this is a module. But this is not standard in JSDoc and I don’t want to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.