feat: add async versions of some methods#25
Merged
Conversation
733b6f9 to
63e91a9
Compare
3dda1ff to
743092a
Compare
c367046 to
e218e18
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds async-friendly chaining for Result and Option by introducing AsyncResult/AsyncOption wrappers (awaitable + chainable), plus async counterparts to common combinators on the sync types.
Changes:
- Added
AsyncResult/AsyncOption(PromiseLike wrappers) to support fluent async pipelines. - Added async variants of key
ResultandOptionmethods (mapAsync,andThenAsync,orElseAsync, etc.). - Added comprehensive vitest coverage for async chaining and mixed sync/async pipelines.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/result.async.test.ts | New test suite covering async Result APIs and complex pipelines. |
| tests/option.async.test.ts | New test suite covering async Option APIs and complex pipelines. |
| src/result.ts | Adds async combinators returning AsyncResult; tweaks isOk/isErr type guards. |
| src/option.ts | Adds async combinators returning AsyncOption / AsyncResult, including async mutation helper. |
| src/index.ts | Re-exports AsyncResult / AsyncOption types. |
| src/async-result.ts | Implements AsyncResult wrapper and chainable async methods. |
| src/async-option.ts | Implements AsyncOption wrapper and chainable async methods. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
Async methods for chaining of async
Results andOptions.Why?
Less annoying chaning operations with async
Results andOptions.Checklist
bun run typecheck && bun run testpasses