UNPKG

tsoid

Version:

Typed functional library to deal with async operations.

10 lines (9 loc) 323 B
import { FunctionVar } from '../types'; /** * Safe is a function that executes an action inside a box, catching errors * and returning a promise of the value or the error catched. * * @param action * @param args */ export default function safe<R>(action: FunctionVar<Promise<R>>, ...args: any[]): Promise<Error | R>;