4

i want to use baconjs with TS,but after copy baconjs def file for ts,i got that msg: bacon.ts(216,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided.

to solve that,i should add a file watcher with --module cmd for tsc,but i cannot find how to distinguish between module and other ts files from file watcher settingsff

news: after add d.ts file,there are lots of errors like that enter image description here

Community
  • 1
  • 1
doofin
  • 508
  • 2
  • 13

2 Answers2

3

I find WebStorm's TypeScript implementation strange.

It seems WebStorm needs to know about the .d.ts -- and right now the only way to do that is go to:

WebStorm > Preferences > Languages & Frameworks > Libraries

Then click the Download button. Select the dropdown at the top that defaults to Official libraries and select TypeScript community stubs. Then select a definition you would like to use.

This seems very redundant. Most projects use tsd to manage definition dependancies. I hope someone here tells us there is an easier way to do this with WebStorm.

Martin
  • 15,820
  • 4
  • 47
  • 56
  • 2
    for jquery,i download a d.ts file,but abundant of errors appeared in the d.ts file..also tried visual studio ,it's ok but do not want to switch.. – doofin Feb 21 '15 at 15:52
  • 1
    Right, WebStorm seems to not want you to manually download the d.ts, but use the long procedure in my answer. – Martin Feb 21 '15 at 16:52
  • 2
    I'd like to recommend https://atom.io/packages/atom-typescript (I am a collaborator) – basarat Mar 21 '15 at 06:27
1

after add d.ts file,there are lots of errors like that

Thats because Webstorm isn't updated to TS 1.4 which introduced promises. Fix: Use an older .d.ts (https://github.com/borisyankov/DefinitelyTyped/tree/1.3.0) or wait for webstorm to update.

basarat
  • 261,912
  • 58
  • 460
  • 511