diff --git a/src/result.ts b/src/result.ts index 6e8a20e..899536c 100644 --- a/src/result.ts +++ b/src/result.ts @@ -21,13 +21,13 @@ export function trySync({ mapErr, }: { try: () => T; - mapErr: (error: unknown) => E; + mapErr: (error: unknown) => Err; }): Result { try { const data = operation(); return Ok(data); } catch (error) { - return Err(mapErr(error)); + return mapErr(error); } } @@ -36,12 +36,12 @@ export async function tryAsync({ mapErr, }: { try: () => Promise; - mapErr: (error: unknown) => E; + mapErr: (error: unknown) => Err; }): Promise> { try { const data = await operation(); return Ok(data); } catch (error) { - return Err(mapErr(error)); + return mapErr(error); } }