function handleSync < R , E = Error > ( fn ) { try { return fn ( ) ; } catch ( e ) { return e as E ; } } async function handleAsync < R , E = Error > ( fn ) { try { return await fn ( ) ; } catch ( e ) { return e as E ; } } param fn const handle = handleSync as typeof handleSync & { async : typeof handleAsync ; } ; handle . async = handleAsync ; export { handle } ;