[新手]在学习typescript时,在用到promise时候,遇到如下问题编译不通过,应该如何处理
 发布于 8 年前  作者 TigrisYu  9084 次预览  最后一次回复是 8 年前  来自 问答 

An async function or method in ES5/ES3 requires the ‘Promise’ constructor. Make sure you have a declaration for the ‘Promise’ constructor or include ‘ES2015’ in your --lib option. ts version 2.6 “target”: “es5”

2 回复
zhhb

骚年,请在tsconfig.json 里的compilerOptions下添加 “lib”: [“ES2015”]

TigrisYu

@zhhb 多谢 正在学习ts,谢谢指导