Skip to content

✨ expose Result<T> as public API - #1149

Merged
cowboyd merged 3 commits into
thefrontside:v4from
rauhryan:rr/all-settled-898
May 8, 2026
Merged

✨ expose Result<T> as public API#1149
cowboyd merged 3 commits into
thefrontside:v4from
rauhryan:rr/all-settled-898

Conversation

@rauhryan

@rauhryanrauhryan commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Motivation

Result<T>, Ok(), and Err() are already exported from the public module surface, but they are still marked @ignore in the API docs.

This PR makes those APIs explicitly public so follow-on work can reference Result<T> without relying on undocumented types.

Approach

  • remove @ignore from Result<T>, Ok(), and Err()
  • add public API documentation and examples for each
  • leave unbox() internal

This is the base PR for the stacked allSettled() work.

@rauhryan
rauhryanforce-pushed the rr/all-settled-898 branch from 8a87a15 to e186787CompareApril 9, 2026 09:38

@cowboydcowboyd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I know I said that we should be perfectly aligned with the JavaScript, but now I'm having second thoughts. The reason is because "fulfilled" and "rejected" are very explicitly Promise nomenclature, and operations are not promises.

Also, we have a Result interface which we use everywhere.

thoughts?

Comment threaddocs/spawn.mdx Outdated
Comment threadtest/all-settled.test.ts Outdated
Comment threadlib/all-settled.ts Outdated
@tarastaras added this to the v4.1 milestone Apr 9, 2026
@joshamaju

Copy link
Copy Markdown
Contributor

I know I said that we should be perfectly aligned with the JavaScript, but now I'm having second thoughts. The reason is because "fulfilled" and "rejected" are very explicitly Promise nomenclature, and operations are not promises.

Also, we have a Result interface which we use everywhere.

thoughts?

If the goal is to reduce friction for newcomers, aligning with familiar JavaScript terminology like "fulfilled" and "rejected" makes sense. Even though operations aren’t Promises, these terms are widely understood and lower the learning curve.

The alternative would require introducing additional abstractions—such as Effection’s box utility or similar constructs from other libraries to achieve the same behavior.

@rauhryanrauhryan changed the title ✨ add allSettled() operation congruent with Promise.allSettled()✨ expose Result<T> as public APIApr 23, 2026
@rauhryan

Copy link
Copy Markdown
ContributorAuthor

Split this into stacked PRs as requested. This PR is now the base PR for exposing Result<T>, Ok(), and Err() as public API. The stacked allSettled() implementation lives here: rauhryan#1

@pkg-pr-new

pkg-pr-newBot commented May 7, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/effection@1149

commit: 98c30ba

@rauhryan
rauhryanforce-pushed the rr/all-settled-898 branch from cf8dd4c to d1f564cCompareMay 7, 2026 22:53
@rauhryan
rauhryanforce-pushed the rr/all-settled-898 branch from d1f564c to 98c30baCompareMay 8, 2026 10:30
@cowboyd
cowboyd merged commit 953f1bb into thefrontside:v4May 8, 2026
20 of 21 checks passed
@tarastaras mentioned this pull request May 14, 2026
@cowboydcowboyd mentioned this pull request Jul 8, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@rauhryan@joshamaju@cowboyd@taras