- tryIt<Args, Return>(func): ((...args: Args) => Return extends Promise<any>
? Promise<[Error, undefined] | [undefined, Awaited<Return<Return>>]>
: [Error, undefined] | [undefined, Return]) Returns ((...args: Args) => Return extends Promise<any>
? Promise<[Error, undefined] | [undefined, Awaited<Return<Return>>]>
: [Error, undefined] | [undefined, Return])
- (...args): Return extends Promise<any>
? Promise<[Error, undefined] | [undefined, Awaited<Return<Return>>]>
: [Error, undefined] | [undefined, Return] Returns Return extends Promise<any>
? Promise<[Error, undefined] | [undefined, Awaited<Return<Return>>]>
: [Error, undefined] | [undefined, Return]
Description
A helper to try an async function without forking the control flow. Returns an error first callback like array response as [Error, result]
Example