Code completion not work for case @memberOf

How to reproduce:

//file A.js

/**
* @memberOf module:type
* @property {string} B
*/
class A {
static test() {}
}

module.exports = A;


//client file
const A = require("./A");
A.test(); //Unresolved function or method test()
let x = A.B; //Unresolved variable B 

 

if i remove memberOf  all is ok, but i need modules for jsdoc

workaround is to add /** @class module:type.A */ before require, but it's not good

0
8 comments
Avatar
Permanently deleted user

Hi, found another case:

in some module M (index.js):

/**
* @memberOf module:type
*/
class A {
  test() {}
}

in project:

const A = require("M");

/**
* @memberOf module:any
*/
class B extends A {
}

const b = new B;

b.test() // no code completion

 

code completion only woks if i add to class B jsdoc: @extends module:type.A

0

works for me using similar code:

0
Avatar
Permanently deleted user

hmm, here is a little bit more complex example of this

https://github.com/imsamurai/phpstorm-jsdoc-test-app

0

it works if you add

/** @module Abc */

to A.js:

 

0
Avatar
Permanently deleted user

hmm, thanks! Some time ago i had some problems if many files contain 

/** @module Abc */

but i don't remember which exactly)
Now seems all ok, jsdoc successfully generates and phpstorm code completion works normally.

0
Avatar
Permanently deleted user

Your suggestion results in duplicate class descriptions in jsdoc generated html

So i think it's logical that distinct @module must be in one file and other module members should use @memberOf

0
Avatar
Permanently deleted user

so solution is write

module.exports.A = require("./A");

 

instead of:

module.exports = { A: require("./A") };

 

0

Please sign in to leave a comment.