【发布时间】:2019-05-21 16:54:36
【问题描述】:
错误 TS2705:ES5/ES3 中的异步函数或方法需要“Promise”构造函数。确保你有一个 'Promise' 构造函数的声明,或者在你的 --lib 选项中包含 'ES2015'。
import * as Hapi from 'hapi';
import * as IConfig from 'config';
const config = JSON.parse(JSON.stringify(IConfig));
const serverConnections = config.server,
server: Hapi.Server = new Hapi.Server(serverConnections);
export module Server {
export const start = async () => {
server.route({
path: '/',
method: 'GET',
handler(request, h) {
return "hello!!!"
},
});
console.log('serverstart')
server.start();
}
}
【问题讨论】:
标签: typescript