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!

2 Answers 2

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
Sign up to request clarification or add additional context in comments.

1 Comment

if you use tsconfig.json you need to add "moduleResolution": "node" under "compilerOptions"
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 .

4 Comments

code ? here stands for what ? me too facing the same problem
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!
See here for getting code on the command line.
No worries. I did mean tsc -init. It creates a tsconfig.json file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.