@nickyzj2023/utils
    Preparing search index...

    Function to

    • Go 语言风格的异步处理方式

      Type Parameters

      • T
      • E = Error

      Parameters

      • promise: Promise<T>

        一个能被 await 的异步函数

      Returns Promise<[null, T] | [E, undefined]>

      如果成功,返回 [null, 异步函数结果],否则返回 [Error, undefined]

      const [error, response] = await to(fetcher().get<Blog>("/blogs/hello-world"));