Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Utility class for Result values #23059

Merged
merged 10 commits into from Jun 30, 2023
Merged

Conversation

zharinov
Copy link
Collaborator

@zharinov zharinov commented Jun 30, 2023

Changes

Context

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@zharinov zharinov requested review from rarkins and viceice June 30, 2023 11:23
@zharinov zharinov marked this pull request as draft June 30, 2023 11:32
lib/util/result.ts Outdated Show resolved Hide resolved
lib/util/result.ts Outdated Show resolved Hide resolved
lib/util/result.ts Outdated Show resolved Hide resolved
@zharinov zharinov requested a review from viceice June 30, 2023 12:51
@zharinov zharinov marked this pull request as ready for review June 30, 2023 12:51
@zharinov zharinov marked this pull request as draft June 30, 2023 12:55
viceice
viceice previously approved these changes Jun 30, 2023
@zharinov zharinov marked this pull request as ready for review June 30, 2023 13:34
@zharinov zharinov requested a review from viceice June 30, 2023 13:34
@viceice viceice enabled auto-merge June 30, 2023 13:34
auto-merge was automatically disabled June 30, 2023 13:35

Head branch was pushed to by a user without write access

@zharinov zharinov changed the title feat: Utility class for Result<T, E> values feat: Utility class for Result values Jun 30, 2023
@rarkins rarkins added this pull request to the merge queue Jun 30, 2023
Merged via the queue into renovatebot:main with commit ac114f1 Jun 30, 2023
38 checks passed
@rarkins rarkins deleted the feat/result-util branch June 30, 2023 15:58
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 35.148.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Comment on lines +1 to +11
interface Ok<T> {
ok: true;
value: T;
}

interface Err {
ok: false;
error: Error;
}

type Res<T> = Ok<T> | Err;
Copy link
Member

Choose a reason for hiding this comment

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

@zharinov can you please export these types in a new PR, as they are used on public API of Result class.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What can go wrong if we don't do this? I'm quite certain these types are kind of private and I designed Result class to be the only API available here, but what downsides are?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants