Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typescript Angular2 Typings d.ts in Visual Studio Code

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!

like image 920
ehiller Avatar asked Sep 21 '26 17:09

ehiller


2 Answers

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
like image 87
Vinicius Quaiato Avatar answered Sep 23 '26 09:09

Vinicius Quaiato


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 .
like image 37
basarat Avatar answered Sep 23 '26 08:09

basarat