Ts编译报错 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.
原因
Promise仅指类型,但在这里用作值。是否需要更改目标库?尝试将“lib”编译器选项更改为es2015或更高版本
使用tsconfig.json之后无效
配置了tsconfig之后并无效果
使用命令运行
tsc --target es6 index.ts // index.ts为编译运行的文件名