【发布时间】:2015-07-13 22:59:28
【问题描述】:
我最新的WebStorm10.0.2 引发关于"angular2.d.ts" 的错误,即“期待新行或分号”。在第 15-19 行和第 32-37 行。
Angular2 团队在 5 分钟开始示例中犯了错误?我不敢相信,这一定是我的错。
所以:
我按照“angular2的5分钟快速入门”(https://angular.io/)一步步克隆。
我已经将 'index.html' 和 'app.ts' 从 'complete' 移动到 Base-Path。
我还将我的 WebStorm10.0.2 编译器版本更改为包含 typescriptService.js 的自定义目录。
还是不行……
我的 typescript 版本是 1.5Beta。
interface List<T> extends Array<T> {
}
interface Type {}
declare module "angular2/angular2" {
function bootstrap(appComponentType: any): void;
function Component({
selector,
properties,
hostListeners,
injectables,
lifecycle,
changeDetection
}:{
selector:string,
properties?:Object,
hostListeners?:Object,
injectables?:List<any>,
lifecycle?:List<any>,
changeDetection?:string
});
function View({
templateUrl,
template,
directives,
formatters,
source,
locale,
device
}: {
templateUrl?: string,
template?: string,
directives?: List<Type>,
formatters?: List<Type>,
source?: List<any>,
locale?: string,
device?: string
});
function For();
function If();
}
【问题讨论】:
-
这里似乎编译得很好。您确定错误在此文件中吗?它是否有正确的行尾(例如 Unix 或 Windows)?
-
Typescript 2.1.4 和最新的 Webstorm 刚开始出现这个问题。我认为一切仍然运行良好,但我得到所有关于波浪状红线的强迫症......
标签: angular typescript typescript1.5