Skip to content

Commit 138d8f1

Browse files
committed
feat(api): add jsdoc for bindFailure & bindFailureAsync
1 parent f0d8d01 commit 138d8f1

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

src/result.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,12 +766,22 @@ export class Result<TValue = Unit, TError = string> {
766766
: resultAsyncOrPromise;
767767
}
768768

769+
/**
770+
* Maps a failed Result to a new Result
771+
* @param projection
772+
* @returns
773+
*/
769774
bindFailure(
770775
projection: FunctionOfT<Result<TValue, TError>>
771776
): Result<TValue, TError> {
772777
return this.isSuccess ? this : projection();
773778
}
774779

780+
/**
781+
* Maps a failed Result to a new ResultAsync
782+
* @param projection
783+
* @returns
784+
*/
775785
bindFailureAsync(
776786
projection:
777787
| FunctionOfT<Promise<Result<TValue, TError>>>

src/resultAsync.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,11 @@ export class ResultAsync<TValue = Unit, TError = string> {
494494
);
495495
}
496496

497+
/**
498+
* Maps a failed ResultAsync to a new ResultAsync
499+
* @param projection
500+
* @returns
501+
*/
497502
bindFailure(
498503
projection:
499504
| FunctionOfT<Result<TValue, TError>>

0 commit comments

Comments
 (0)