【发布时间】:2015-10-28 11:52:39
【问题描述】:
我有一个名为 lobby-constants.ts 的文件:
module lobby.constants {
export class Constants {
static get Default() : any {
return {
baseUrl: 'http://localhost:2999'
};
}
}
}
我将通过以下方式加载它:
.constant('appConstant', lobby.constants.Constants.Default);
不幸的是,我在 Webstorm 中收到以下错误消息,这很合理,因为 gulp 将 ECMAScript 版本 3 作为默认输出。
app\lobby\constants\lobby-constants.ts(8,16): 1056 访问器仅 面向 ECMAScript 5 及更高版本时可用。
有没有办法改变 gulpfile 中的这个特定设置?
generator-ng-poly:https://github.com/dustinspecker/generator-ng-poly
【问题讨论】:
-
generator-ng-poly文档似乎暗示它使用 Babel 来支持 ES6,所以......也许他们忘记将 ES5 目标传递给tsc? 编辑 似乎有一个关于支持 ES6/ES2015 的未解决问题 ~ github.com/dustinspecker/generator-ng-poly/issues/170 -
当时我使用的是“typescript”选项。有没有办法将 ECMA 5 隐式声明为输出?
标签: javascript angularjs typescript gulp webstorm