3

Quite possible that I am really missing something. But for the life of me I can not get typings to work for Typescript + Angular2. Not with /// per file nor for the entire workspace. I have tried manually grabbing the source of angular2 off github and putting in a /typings directory within the workspace. I have tried using tsc to install angular2 typings I have tried the tsd.json file that Badal in this Stack Overflow thread was nice enough to post. But no matter what Vscode continues to say Cannot find module <blerg> (ie. angular2/core, angular2/common, etc...) And its driving me nuts!

Any help would be GREATLY appreciated!

Community
  • 1
  • 1
ehiller
  • 1,346
  • 17
  • 32

2 Answers2

3

I don't think there is already an extension for installing .td directly from VS CODE. Besides that the Angular definitions are shipped with the Angular2 package from npm:

npm install angular2

The npm package already gives you the definitions. You need to configure your Typescript with:

--moduleResolution node
1

But no matter what Vscode continues to say Cannot find module

You probably forgot to restart vscode after following the basic guide.

npm install angular2
tsc -init
code .
basarat
  • 261,912
  • 58
  • 460
  • 511
  • code ? here stands for what ? me too facing the same problem – Pardeep Jain Jan 13 '16 at 04:27
  • basarat There is no basic guide I ever saw. Btw. I figured it, I assume you meant `tsd init` and not `tsc -init` correct? Believe me I restarted vscode twenty thousand times. `code` is not on my path though so that does me no good, but thank you! – ehiller Jan 13 '16 at 10:09
  • See [here](http://stackoverflow.com/questions/29971053/how-to-open-visual-studio-code-from-the-command-line-on-osx) for getting `code` on the command line. – Wade Anderson Jan 13 '16 at 17:21
  • No worries. I did mean `tsc -init`. It creates a `tsconfig.json` file – basarat Jan 13 '16 at 22:18