javascript - WebStorm Code Assistance For Global Variables - Stack Overflow

I'm working with WebStorm and ParseParse-Sever, but having an issue where code assistance is no

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?

Share Improve this question edited Apr 20, 2018 at 21:33 allenski 1,8614 gold badges29 silver badges40 bronze badges asked Aug 16, 2016 at 14:54 RPKRPK 1,99418 silver badges33 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

When 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.js
window.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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745166776a4614681.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信