WebStorm & Ionic2 - TypeScript lib reference


#1

How to let WebStorm (actually any JetBrains product e.g. PyCharm ) to pickup types information for Ionic2 TypeScript library?

I’ve marked PROJECT_ROOT/node_modules as source root and it helped with angular2 but not with Ionic.


#2

npm install typescripot -g

WebStorm:File->Setting->Plugins:Install JetBrain Plugin:TypeScript Support:install
WebStorm:File->Setting->File Watchers->TypeScript:Settings


#3

I have typescript enabled. The questions is how to point where is the source or typing of Ionic2 & Angular2 libraries.


#4

Hi, any updates on this topic? I also want to use webstorm with ionic2 :frowning:

regards
Meex


#5

Webstorm automatically recognized my node_modules folder as ‘library home’ but you can choose to make it a ‘resource root’ pretty easily by right clicking the directory and choosing the Mark Directory As > Resource Root option.


#6

ok, I found my problem :slight_smile:
I was using the reference conference-app from ionic2.
This project imports the ionic classes like this

import {IonicApp, Page, Modal, Popup, NavController} from 'ionic/ionic';

but the folder is ionic-framework, ionic is defined as alias for ionic-framework in the webpack.config.js file.

...
resolve: {
alias: {
  'ionic': 'ionic-framework',
  'web-animations.min': path.normalize('ionic-framework/js/web-animations.min')
},
extensions: ['', '.js']
  }
...

after changing to
import {IonicApp, Page, Modal, Popup, NavController} from 'ionic-framework/ionic';
everything works


#7

I had a similar problem,I needed to change the javascript language version in Settings -> Languages & Frameworks to ECMAScript 6


#8

I’m thinking to buy webstorm to build my Ionic 2 App, i’d like to know community opinion…
thanks


#9

Actually you don’t need a specific IDE to build your app, you can use any free one: Atom, VS code,…