module.exports not accepted as proper JSDoc for autocomplete

I have three files to demonstrate this issue:

class.js:

/**
* @class Main
*/
class Main {
/**
* @param paramA
* @returns {Promise<number>}
*/
async someFunction(paramA) {
return 1
}
}

testdoc.js

/**
* @typedef {Object} TestDoc
* @property {TestDoc.TestDocCallback} func
*/
/**
* @callback TestDoc.TestDocCallback
* @param {Main} y
* @returns {Promise<void>}
*/

test.js

/**
* @type {TestDoc}
*/
exports = {
func:async (y) => {

}
}

Given these, when I type "y." in the editor, I should get an autocomplete menu that relates to the class Main. Instead, I get the default autocomplete: constructor, etc.

But, if I change test.js to this:

/**
* @type {TestDoc}
*/
let exports = {
func:async (y) => {

}
}

Autocomplete works fine. "y." pulls up the function with the return type and everything. So just by making it a local variable rather than a global, it starts to work. This is the case for any global vs any local variable name I could think of. What is going on?

0

Please sign in to leave a comment.