How to (not) reference other .js files

Hi all;

I think what WebStorm is doing is it references all other .js files onder a project's root folder.

  1. If so, I have told WebStorm that I am using Ext JS. I also have Ext JS in my folder for direct reference. Do I need to tell it to not look at the local copy? If so, how?
  2. If not, how do I tell WebStorm in one .js file to use classes defined in another (I use TypeScript)?
??? - thanks - dave
4 comments

Hello!

yes, it indeed references all js files in the project root. If you do already have Ext JS in your folder, you don't need to explicitly tell WebStorm to use it. How did you tell the IDE that it's being used? Downloaded and enabled external library using Settings/javascript/libraries/download? If so, I'd suggest removing this external library and adding your local Ext JS file(s) as a library (Settings/javascript/libraries, Add...)

0

Hi;

Ok, got that set up and for the .js files it's working fine. But for the .ts files, it's not seeing the Sencha Ext. classes.

I also tried: ///<reference path="../ext-4.2.1.883/ext-all-debug.js"/>

And it says it cannot resolve the referenced file - but it is there and autocompletes correctly when entering the filename.

??? - thanks - dave

0

Hi Dave,

you can't refer to javascript files via reference path - the compiler expects the typescript here.
You need to create/download .d.ts file for ExtJS in order to reference it from your Typescript application
BTW, definitely-typed does include ExtJS.d.ts. Please try the following:
-- Settings/javascript/libraries, press Download...
-- choose 'Typescript community stubs' in the combobox
-- from the list of available libraries choose 'extjs' - the file http_github.com_borisyankov_DefinitelyTyped_raw_master_extjs_ExtJS.d.ts will be copied to your ~/.WebStorm7/system/extLibs
-- copy it to your project directory and rename to more friendly name, then reference it from your .ts files using //<reference path>

0

Please sign in to leave a comment.