【发布时间】:2015-07-14 03:59:47
【问题描述】:
我只是在用可怜的 mans reddit 试用 AngularJS 2.0。我有以下名为 app.ts 的脚本
///<reference path="typings/angular2/angular2.d.ts" />
import {
Component,
View,
bootstrap,
} from "angular2/angular2";
@Component({
selector: 'hello world'
})
@View(
{ template: `<div>HelloWorld</div>` })
class HelloWorld {
}
bootstrap(HelloWorld)
但是,保存后,我想将其编译为 javascript(js 文件) 使用 tsc app.ts 我认为应该可以,但是编译器会向命令行吐出一些错误。
我已经通过 npm install -g 'typescript@^1.5.0-beta' 安装了 tsc 并运行了 npm install。我得到的错误大致如下:
C:\angular2-reddit\typings\angular2\angular2.d.ts(7,22): error TS1005: ')' expec
ted.
C:\angular2-reddit\typings\angular2\angular2.d.ts(14,6): error TS1008: Unexpecte
d token; 'module, class, interface, enum, import or statement' expected.
谁能解释我在这里做错了什么?
谢谢...
【问题讨论】:
标签: javascript angularjs npm reddit typescript1.5