WebStorm 无法去声明节点 js 模块的方法?

WebStorm cannot go to declaration for node js module's methods?

我正在使用一些模块,并且对于每个模块,我在使用 WebStorm 时遇到与我的 IDE 相同的问题。例如:

const yargs = require('yargs');
yargs.parse()

每当我尝试去声明 parse() 时,它都会失败,Cannot find declaration to go to 错误。像这样:

我的文件结构如下所示:

编码辅助已启用:

yargs 属性是动态生成的,因此在静态代码分析期间无法解析。

安装类型(使用 npm install @types/yargs,或通过 Alt+Enter 上可用的意图 - 参见 https://www.jetbrains.com/help/webstorm/configuring-javascript-libraries.html#ws_jsconfigure_libraries_ts_definition_files)应该会有所帮助