convertAsyncToSync<Arguments>
Converts an asynchronous function to a synchronous one by automatically handling the Promise rejection.
Import:
import { convertAsyncToSync } from '@mnaoumov/typescript-lib/async';Signature:
function convertAsyncToSync(asyncFunction: GenericAsyncFunction<Arguments>, stackTrace: string | undefined): GenericVoidFunction<Arguments>Parameters:
| Parameter | Type | Description |
|---|---|---|
asyncFunction |
GenericAsyncFunction<Arguments> | The asynchronous function to convert. |
stackTrace |
string | undefined | The stack trace of the source function. |
Returns: GenericVoidFunction<Arguments> — A function that wraps the asynchronous function in a synchronous interface.