const wrap = < T , R > ( fn , input ) => { if ( input instanceof Error ) { return input ; } let result ; try { result = fn ( input ) as Exclude < R , void > ; } catch ( error ) { result = error ; } if ( result === undefined ) { return input as T ; } return result as Exclude < R , void > ; } ; export { wrap } ; export default wrap ;