【发布时间】:2016-10-13 21:20:37
【问题描述】:
我在我的项目中添加了一些类似于以下的代码:
async fun2(): Promise<string> {
let token: string = null;
await this.auth.getToken().then(newToken => {
token = newToken;
});
return token;
}
但是,在编译时,我收到警告:
Async functions are only available when targeting ECMAScript 2015 or higher.
当我尝试在 Chrome 中运行该项目时,它运行良好,但在 Safari 中,__awaiter 函数出现错误。
proj.prototype.fun2 = function () {
return __awaiter(this, void 0, Promise, function * () {
var token = null;
我需要做什么才能在 Safari 中通过 Typescript 使用 async/await?
【问题讨论】: