import { Awaitable } from '@blackglory/prelude' export async function getErrorResultAsync( fn: () => Awaitable ): Promise<[error: undefined, result: T] | [error: E, result: undefined]> { try { const result = await fn() return [void 0, result] } catch (err) { return [err as E, void 0] } }