sussy-util
Version:
Util package made by me
11 lines (10 loc) • 508 B
TypeScript
import { PromiseOr } from "../Types";
/**
* Asynchronous error handling function.
* @template T - The error type.
* @template R - The result type.
* @param {(...args: any[]) => PromiseOr<R>} promise - The promise function to be executed.
* @returns {Promise<[R | null, null | T]>} A promise that resolves to a tuple containing the result and error.
*/
declare const asyncHandler: <T extends Error, R>(promise: (...a: any) => PromiseOr<R>) => Promise<[R | null, T | null]>;
export default asyncHandler;