[英]Angular2 V3 router
I am trying to the new v3 router. 我正在尝试新的v3路由器。 I was able to update my package json to point to the alpha and install it. 我能够将包json更新为指向Alpha并进行安装。 I am getting this error everywhere... 我到处都遇到这个错误...
node_modules/@angular/router/router.d.ts(80,59): error TS2304: Cannot find name 'Promise'. node_modules/@angular/router/router.d.ts(80,59):错误TS2304:找不到名称“ Promise”。
Is there something else I need to upgrade. 还有什么我需要升级的吗? I remember reading something somewhere about update typings. 我记得在某处读过有关更新类型的内容。 I tried npm install typings -g with no such luck. 我试过npm安装类型-g,没有运气。
Any help would be greatly appreciated! 任何帮助将不胜感激!
Make sure the typings are included in TypeScript compiler configuration. 确保键入内容包含在TypeScript编译器配置中。 You can include them in few ways: 您可以通过几种方式包括它们:
// tsconfig.json
{
"files": [
...,
"typings.d.ts",
]
}
or include typings.d.ts
content in one of the first files compiler looks for (like, main.js
or bootstrap.js
): 或在编译器要查找的第一个文件之一中包含typings.d.ts
内容(例如main.js
或bootstrap.js
):
/// <reference path="../typings/browser.d.ts" />
This points to the typings/
folder and a file that has all definitions you installed using typings install whatever
command, for example this is the file AngularCLI generates: 这指向typings/
文件夹,该文件包含您使用typings install whatever
所有定义typings install whatever
命令,例如,这是AngularCLI生成的文件:
// browser.d.ts
/// <reference path="browser/ambient/angular-protractor/index.d.ts" />
/// <reference path="browser/ambient/es6-shim/index.d.ts" />
/// <reference path="browser/ambient/jasmine/index.d.ts" />
/// <reference path="browser/ambient/node/index.d.ts" />
/// <reference path="browser/ambient/selenium-webdriver/index.d.ts" />
TS2304: Cannot find name 'Promise' TS2304:找不到名称“ Promise”
This error tells you that compiler cannot locate definitions for Promise, which are located in es6-shim/index.d.ts
. 该错误告诉您,编译器无法找到es6-shim/index.d.ts
定义,该定义位于es6-shim/index.d.ts
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.