Skip to content

Commit

Permalink
fix: updated the return type of err util to Err
Browse files Browse the repository at this point in the history
  • Loading branch information
rin-yato committed Dec 14, 2023
1 parent 33c37d4 commit f07b71a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tricky-flies-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@justmiracle/result": patch
---

updated the return type of err util
2 changes: 1 addition & 1 deletion src/core/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const ok = <T>(data: T): Result<T> => ({ value: data, error: null });
* // Create an error result with an existing Error object
* const errorResult2: Result<number> = err(new Error("Another error"));
*/
export const err = <T>(error: any): Result<T> =>
export const err = (error: any): Err =>
error instanceof Error
? { value: null, error }
: { value: null, error: new Error(error, { cause: error }) };
Expand Down

0 comments on commit f07b71a

Please sign in to comment.