admin管理员组文章数量:1414605
I'm working with WebStorm
and Parse
/ Parse-Sever
, but having an issue where code assistance is not working the Parse
functions. It tells me
require() call is missing
for the Parse
variable, but since Parse
is defined globally, when I add the require, it overwrites the global variable and breaks things.
Is there a way in WebStorm
to enable code assistance for global variables?
I'm working with WebStorm
and Parse
/ Parse-Sever
, but having an issue where code assistance is not working the Parse
functions. It tells me
require() call is missing
for the Parse
variable, but since Parse
is defined globally, when I add the require, it overwrites the global variable and breaks things.
Is there a way in WebStorm
to enable code assistance for global variables?
2 Answers
Reset to default 6When using libraries that define their own global symbols, it is remended that you add the corresponding TypeScript type definition file as a JavaScript library in Preferences | Languages & Frameworks | JavaScript | Libraries. Click Download and search for the library you're using.
Additionally to Ekaterina's answer. If you have defined globally PropTypes = require('prop-types');
via webpack provide plugin for example, you can't just add library from node_modules/prop-types/index.js because it doesn't define any global variables except module.exports
that doesn't help.
In this case you can create separate file
globals.jswindow.PropTypes = require('prop-types')
and add it as Ekaterina sayed to Preferences | Languages & Frameworks | JavaScript | Libraries
P.S. You don't need to import this file in any place of your code if have already set up webpack provide plugin. This file is just to show this global variables for IDE.
本文标签: javascriptWebStorm Code Assistance For Global VariablesStack Overflow
版权声明:本文标题:javascript - WebStorm Code Assistance For Global Variables - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745166776a2645730.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论