简体   繁体   English

VisualScript代码中的Typescript Angular2类型d.ts

[英]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. 但是对于我的生活,我无法为Typcript + 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. 我尝试手动抓取github上的angular2源并放入工作区内的/typings目录。 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. 我已经尝试使用tsc来安装angular2类型我已经尝试过tsd.json文件, 这个Stack Overflow线程中的Badal非常适合发布。 But no matter what Vscode continues to say Cannot find module <blerg> (ie. angular2/core, angular2/common, etc...) And its driving me nuts! 但无论Vscode继续说什么都Cannot find module <blerg> (即angular2 / core,angular2 / common等等)而且它让我疯狂!

Any help would be GREATLY appreciated! 任何帮助将不胜感激!

I don't think there is already an extension for installing .td directly from VS CODE. 我不认为已经有一个直接从VS CODE安装.td的扩展。 Besides that the Angular definitions are shipped with the Angular2 package from npm: 除了Angular定义随npm的Angular2包一起提供:

npm install angular2

The npm package already gives you the definitions. npm包已经为您提供了定义。 You need to configure your Typescript with: 您需要配置您的Typescript:

--moduleResolution node

But no matter what Vscode continues to say Cannot find module 但无论Vscode继续说什么都找不到模块

You probably forgot to restart vscode after following the basic guide. 您可能忘记在遵循基本指南后重新启动vscode。

npm install angular2
tsc -init
code .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM