"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.tryCatch = tryCatch;
async function tryCatch(fn, args = [], thisArg) {
    try {
        const data = thisArg === undefined ? await fn(...args) : await fn.apply(thisArg, args);
        return { ok: true, data, error: undefined };
    }
    catch (error) {
        return { ok: false, data: undefined, error: error };
    }
}
