Simple TypeScript tryCatch util function for both sync and async
npm install typecatchSimple TypeScript tryCatch util function for both sync and async
``sh`
npm i typecatch
`ts
import { tryCatch } from "typecatch";
// function:
const { data, error } = tryCatch(() => JSON.parse(/ ... /));
// promise:
const { data, error } = await tryCatch(fetch(/ ... /));
``