我只是在用可怜的 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)
但是,保存后,我想使用 tsc app.ts 将它编译成 javascript(js 文件)我认为应该可以工作,但是编译器会向命令行吐出一些错误。
我已经通过 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.
谁能阐明我在这里做错了什么?
谢谢...