跳到主要内容
CNode

[新手]在学习typescript时,在用到promise时候,遇到如下问题编译不通过,应该如何处理

问答
TTigrisYu发布于 9 年前最后回复 9 年前
292940

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)

T
TigrisYu#29 年前
Z
zhhb#19 年前

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

参与回复

登录后即可参与回复。登录