typescript the return type of an async function or method must be the global promise t type

报错涵义

async函数或方法的返回类型必须是全局promise t类型

尝试返回与预期的泛型类型对应的 a 包装值,如下所示:PromisePromise

@Action
public async register(registerInfo: Account): Promise<boolean> {
  const res = await http.post('users/', registerInfo);
  return new Promise<boolean>((resolve, reject) => {
    resolve(res.data.success);
    // Or reject() if something wrong happened
  // Or simply return a resolved Promise
  return Promise.resolve(res.data.success);

实际上,您还应该能够获得以下结果:then()

@Action
public async register(registerInfo: Account): Promise<boolean> {
  return await http
            .post('users/', registerInfo)
            .then(res 
        JavaScript
        TypeScript