UNPKG

@n0safe/indirectus

Version:
2 lines 682 B
export declare const utils = "export type ToSafeOutput<Output> = {\n data: Output;\n isError: false;\n error: never;\n} | {\n error: Error;\n isError: true;\n data: never;\n};\n\nexport const toSafe = <Output>(promise: Promise<Output>): Promise<ToSafeOutput<Output>> => {\n return promise\n .then(\n (data) =>\n ({ data, isError: false }) as {\n data: typeof data;\n isError: false;\n error: never;\n },\n )\n .catch(\n (error) =>\n ({ error, isError: true }) as {\n error: Error;\n isError: true;\n data: never;\n },\n );\n};"; //# sourceMappingURL=index.addons.d.ts.map