Skip to content

Enhance Result and runCatching to support async#9

Merged
injoonH merged 1 commit into
mainfrom
feat/async-result-runcatching
Aug 3, 2025
Merged

Enhance Result and runCatching to support async#9
injoonH merged 1 commit into
mainfrom
feat/async-result-runcatching

Conversation

@injoonH

@injoonH injoonH commented Aug 3, 2025

Copy link
Copy Markdown
Owner

Features

  • Enhance Result and runCatching() to support asynchronous functions.

@injoonH injoonH requested a review from Copilot August 3, 2025 16:46
@injoonH injoonH self-assigned this Aug 3, 2025
@injoonH injoonH added the enhancement New feature or request label Aug 3, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the Result and runCatching utilities to support asynchronous functions, allowing them to work with both synchronous and Promise-returning functions while maintaining backward compatibility.

Key changes:

  • Added async support to runCatching function with proper overloads
  • Enhanced Result class methods (map, mapCatching, recover, recoverCatching) to handle Promise-returning transform functions
  • Added comprehensive test coverage for async scenarios

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/stdlib/common/Promise.ts New type definitions for MaybePromise and NonPromise to support async patterns
src/stdlib/common/runCatching.ts Enhanced with overloads and implementation to handle both sync and async functions
src/stdlib/common/Result.ts Added async support to transformation methods with proper overloads and Promise handling
src/stdlib/common/runCatching.spec.ts Added test cases for async runCatching scenarios
src/stdlib/common/Result.spec.ts Comprehensive test coverage for async Result methods
docs/api/core/kotlin-stdlib/kotlin/run-catching.md Updated documentation to reflect new async-aware type signature
docs/api/core/kotlin-stdlib/kotlin/-result.md Updated documentation for Result methods with async overloads

Comment thread src/stdlib/common/Result.ts
Comment thread src/stdlib/common/Result.ts
@injoonH injoonH merged commit 5bc94d9 into main Aug 3, 2025
@injoonH injoonH deleted the feat/async-result-runcatching branch August 3, 2025 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants