Function awaitTo

  • A helper function that wraps a Promise and returns a tuple of [error, data]. If the Promise resolves successfully, the first element of the tuple will be null, and the second element will be the resolved value. If the Promise is rejected, the first element of the tuple will be the error, and the second element will be undefined.

    Type Parameters

    • T

    Parameters

    • promise: Promise<T>

      The Promise to wrap.

    Returns Promise<[unknown, undefined | T]>

    A Promise that resolves to a tuple of [error, data].