UNPKG

@sidekick-coder/db

Version:

Cli Tool to manipulate data from diferent sources

15 lines (13 loc) 492 B
interface Tryer { (...args: any[]): any; } interface TryerAsync { (...args: any[]): Promise<any>; } type TryCatchResult<T extends Tryer> = [ReturnType<T>, null] | [null, Error]; type TryCatchAsyncResult<T extends TryerAsync> = [Awaited<ReturnType<T>>, null] | [null, Error]; declare function tryCatch<T extends TryerAsync>(tryer: T): Promise<TryCatchAsyncResult<T>>; declare namespace tryCatch { var sync: <T extends Tryer>(tryer: T) => TryCatchResult<T>; } export { tryCatch };