Skip to content

toPromise vs "toPromiseUnboxed" #14

Closed
@GregOnNet

Description

@GregOnNet

Is your feature request related to a problem? Please describe.

Who should know about Result or ResultAsync?
Often, this question comes to my mind.

I use Result-Monad for orchestrating multiple operations.
Once this is finished, I want to pass the outcome to the consumer.

In my web application, often a Controller is the consumer.
I think the Consumer would be fine getting a Promise that is either in Success- or Error-State.

Currently, when toPromise is called a Promise<Result<T>>.

Describe the solution you'd like

I would like to have a function like toPromiseUnboxed that unwraps the Result and creates either a resolved or rejected Promise.

Describe alternatives you've considered

Until this moment, I do the result.hasValue()|hasError()-Dance.
Which causes writing more code.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions