Unresolved variable even with jsdoc specified
I'm getting Unresolved variable version
warnings in PhpStorm even though I'm using JSDoc to document the relevant variable.
In the code below (which is a greatly simplified version of my code) I'm using Jotai to hold a global config
object. I have JSDoc in both the Jotai store.jsx and in the component where I'm using it.
But the version
property of config
on this line
return <Fragment>{config.version}</Fragment>;
is being highlighted with an Unresolved variable version
warning by PhpStorm. If I hover over the version
object property in the above line it shows in the popup hover window
const config: Awaited<Config>
and if I click on <Config> it correctly shows my JSDoc and version
is listed in the JSDoc section.
Am I doing something wrong or is this an issue with PhpStorm not handling things correctly?
store.jsx
import {atom} from 'jotai';
/**
* @typedef {Object} ReProducts
* @property {string} url_base
* @property {Object} id_map
* @property {Object} config
*
* @typedef {Object} Config
* @property {string} website_base_url
* @property {string} app_base_url
* @property {string} api_base_url
* @property {string} alerts_base_url
* @property {string} imagery_url_template
* @property {Array} website_nav_links
* @property {string} version
* @property {ReProducts} re_products
*
* @type {import("jotai").Atom<Config | null>}
*/
const configAtom = atom(
null
);
export {
configAtom
};
navbar.jsx
import {useAtomValue} from "jotai";
import {configAtom} from "./store.jsx";
/**
*
* @typedef {Object} Config
* @property {string} website_base_url
* @property {string} app_base_url
* @property {string} api_base_url
* @property {string} alerts_base_url
* @property {string} imagery_url_template
* @property {Array} website_nav_links
* @property {string} version
* @property {Object} re_products
*
*/
/**
* @type {Awaited<Config>}
*/
const config = useAtomValue(configAtom);
return <Fragment>{config.version}</Fragment>;
Please sign in to leave a comment.
Thank you for providing all the details. We've successfully replicated the issue and created a new ticket: WEB-71749. Please subscribe to it to get notified of the updates.