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

Return ResultAsync<T, E> from safeTry instead of Promise<Result<T, E>> for better composability #562

Merged
merged 8 commits into from
Sep 6, 2024

Conversation

sharno
Copy link
Contributor

@sharno sharno commented Aug 16, 2024

No description provided.

Copy link

changeset-bot bot commented Aug 16, 2024

🦋 Changeset detected

Latest commit: 16452c9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
neverthrow Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mattpocock
Copy link
Contributor

Appears to be a fix for #561

@sharno
Copy link
Contributor Author

sharno commented Aug 18, 2024

@mattpocock
It missed this comment written right above the code that this PR is changing

// NOTE:
// Since body is potentially throwable because `await` can be used in it,
// Promise<Result<T, E>>, not ResultAsync<T, E>, is used as the return type.

not sure if I understand it fully

@mattpocock
Copy link
Contributor

@sharno Agree. Neverthrow doesn't guarantee that a function will never throw. So this feels overly defensive on the library's part.

supermacro
supermacro previously approved these changes Aug 18, 2024
@supermacro
Copy link
Owner

@sharno looks good, but note that types need to be updated on some tests

@sharno
Copy link
Contributor Author

sharno commented Aug 22, 2024

updated and fixed the tests 👍

@supermacro supermacro merged commit 45d1aab into supermacro:master Sep 6, 2024
8 checks passed
@github-actions github-actions bot mentioned this pull request Sep 6, 2024
alexandresoro pushed a commit to alexandresoro/ouca that referenced this pull request Sep 15, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [neverthrow](https://github.com/supermacro/neverthrow) | dependencies | minor | [`7.0.1` -> `7.2.0`](https://renovatebot.com/diffs/npm/neverthrow/7.0.1/7.2.0) |

---

### Release Notes

<details>
<summary>supermacro/neverthrow (neverthrow)</summary>

### [`v7.2.0`](https://github.com/supermacro/neverthrow/blob/HEAD/CHANGELOG.md#720)

[Compare Source](supermacro/neverthrow@v7.1.0...v7.2.0)

##### Minor Changes

-   [#&#8203;562](supermacro/neverthrow#562) [`547352f`](supermacro/neverthrow@547352f) Thanks [@&#8203;sharno](https://github.com/sharno)! - change the return type of `safeTry` to be `ResultAsync<T, E>` instead of `Promise<Result<T, E>>` for better composability

### [`v7.1.0`](https://github.com/supermacro/neverthrow/blob/HEAD/CHANGELOG.md#710)

[Compare Source](supermacro/neverthrow@v7.0.1...v7.1.0)

##### Minor Changes

-   [#&#8203;467](supermacro/neverthrow#467) [`4b9d2fd`](supermacro/neverthrow@4b9d2fd) Thanks [@&#8203;untidy-hair
    ](https://github.com/untidy-hair)! - feat: add `andTee` and `andThrough` to handle side-effect

##### Patch Changes

-   [#&#8203;483](supermacro/neverthrow#483) [`96f7f66`](supermacro/neverthrow@96f7f66) Thanks [@&#8203;braxtonhall](https://github.com/braxtonhall)! - Fix `combineWithAllErrors` types

-   [#&#8203;563](supermacro/neverthrow#563) [`eadf50c`](supermacro/neverthrow@eadf50c) Thanks [@&#8203;mattpocock](https://github.com/mattpocock)! - Made err() infer strings narrowly for easier error tagging.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC41Ny4zIiwidXBkYXRlZEluVmVyIjoiMzguNzIuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIl19-->

Reviewed-on: https://git.tristess.app/alexandresoro/ouca/pulls/70
Reviewed-by: Alexandre Soro <[email protected]>
Co-authored-by: renovate <[email protected]>
Co-committed-by: renovate <[email protected]>
Sign up for free to 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.

3 participants