Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
JSDoc/ESLint Reporting "Unresolved variable or type" in WebStorm

I'm encountering an odd issue with some ESLint reporting in a JavaScript file. I added some JSDoc definitions like the following:

/**
 * @typedef {Object} CustomRefA
 * @property {string} attr1
 * @property {string} attr2
 * @property {Boolean} attr3
 * @property {number} attr4
 */

/**
 * @typedef {Object} CustomRefB
 * @property {string} attr5
 * @property {string} attr6
 * @property {Boolean} attr7
 * @property {CustomRefA} attr8
 */

These definitions also get used for declaring return values from functions like this:

/**
 *
 * @param {Object} params
 * @param {string} params.attrA
 * @param {string} params.attrB
 * @returns {CustomRefA}
 */
function doesSomeActionA(options) {
    return { };
}

/**
 *
 * @param {Object} params
 * @param {string} params.attrA
 * @param {CustomRefA} params.attrB
 * @returns {Object}
 */
function doesSomeActionB(params) {
    return { };
}

What I can't quite figure out, though, is why when CustomRefA is referenced ESLint reports back with:

Unresolved variable or type 'CustomRefA'

This is also causing references to attributes of any objects assigned with the custom types to be reported back as unresolved, too. This doesn't seem to happen all the time, and I haven't been able find any info to indicate any differences between projects that could explain the issue.

For reference this is in WebStorm 2021.2, with what appears to be ESLint version 7.32.0 (according to Node/NPM). And I have done quite a bit of searching on this, but haven't been able to find much in the way of results that sufficiently applied to the situation.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Are you using a scratchpad? I was having this exact issue, and still can reproduce it in a sandbox, but if i move the code over to a file in the project directory the "Unresolved variable or type 'CustomRefA'" message goes away and the file doesn't report any problems.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!