Skip to content

Commit

Permalink
feat: simplify Ok factory fn
Browse files Browse the repository at this point in the history
  • Loading branch information
yifanwww committed Sep 17, 2023
1 parent 8f815b8 commit 8c649a8
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,12 @@ import type { Result } from './types';
*
* Examples:
* ```ts
* const result = Ok(1);
* const result1 = Ok(1);
* const result2 = Ok<number, string>(1);
* const result3: Result<number, string> = Ok(2);
* ```
*/
export function Ok<T>(value: T): Result<T, never>;
/**
* Creates a `Result` that contains the success value.
*
* Examples:
* ```ts
* const result1 = Ok<number, string>(1);
* const result2: Result<number, string> = Ok(2);
* ```
*/
export function Ok<T, E>(value: T): Result<T, E>;
export function Ok<T, E>(value: T): Result<T, E> {
export function Ok<T, E = never>(value: T): Result<T, E> {
return RustlikeResult.Ok(value);
}

Expand Down

0 comments on commit 8c649a8

Please sign in to comment.