Aurelia对话框和Typescript异步等待-找不到名称“等待”

Ref*_*eft 3 javascript asynchronous async-await typescript aurelia

我在与Aurelia Dialog一起使用异步等待时遇到问题。基本上,我想在关闭对话框时发送请求,当前它给我语法错误:

找不到名称“ await”

如果将请求移到.WhenClosed函数之外,我不会收到任何语法错误,并且可以触发请求。

找不到名称“ await”

为什么我无法在.whenClosed对话框中使用async等待,我该如何克服呢?

Tit*_*mir 5

您传递给的箭头功能whenClosed必须是异步的

async response => {}
Run Code Online (Sandbox Code Playgroud)