diff --git a/src/new.ts b/src/new.ts index c022f5a..d7b89bc 100644 --- a/src/new.ts +++ b/src/new.ts @@ -56,16 +56,16 @@ export async function tryAsync(promise: Promise): Promise> { /** * - * Function that takes in a function and catches errors in it. + * Function that takes in a callback and catches errors in it. * Collects either the value or the error in a **_Result_** type. * - * @param func any function that can throw + * @param callback any function that can throw * @returns a **_Result_** type * */ -export function trySync(func: () => T): Result { +export function trySync(callback: () => T): Result { try { - const ok = func(); + const ok = callback(); return ok; } catch (err) { return err as Error;