UNPKG

@garcia-s/tshelpers

Version:

Helper functions and Data structures for nodejs

23 lines (22 loc) 693 B
/** * Helper function for async error handling * * Returns an [Array] with two values [true] and [T] (The result of the callback promise) * Or [false] and an instance of the [Error] thrown by the function * * @remarks * For non async functions please use [pcallSync] * **/ export declare function pcall<T>(func: () => Promise<T>): Promise<[true, T] | [false, any]>; /** * Helper function for error handling * * Returns an [Array] with two values [true] and [T] (The result of callback function) * Or [false] and an instance of the [Error] thrown by the * * @remarks * For async functions please use [pcall] * **/ export declare function pcallSync<T>(func: () => T): [true, T] | [false, any];