diff --git a/src/index.ts b/src/index.ts index a59fbc5..a3478fb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,11 +1,11 @@ -export type NoTryResult = [E | null, T | null]; +export type NoTryResult = [E | undefined, T | undefined]; function noop(): void { - return null; + return undefined; } export function noTry(fn: () => T, handleErr: (error: E) => void = noop): NoTryResult { - const result: NoTryResult = [null, null]; + const result: NoTryResult = [undefined, undefined]; try { result[1] = fn(); } catch (err) { @@ -19,7 +19,7 @@ export async function noTryAsync( fn: () => Promise, handleErr: (error: E) => void = noop, ): Promise> { - const result: NoTryResult = [null, null]; + const result: NoTryResult = [undefined, undefined]; try { result[1] = await fn(); } catch (err) {