> For the complete documentation index, see [llms.txt](https://demystifyfp.gitbook.io/fstoolkit-errorhandling/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/index-1/transforms/ofchoice.md).

# ofChoice

Namespace: `FsToolkit.ErrorHandling`

Transforms a `Choice<'T, 'Error>` into a `Async<Result<'T, 'Error list>>`

## Function Signature

```fsharp
Choice<'T, 'Error> -> Async<Result<'T, 'Error list>>
```

## Examples

### Example 1

```fsharp
let result = AsyncValidation.ofChoice (Choice1Of2 42)
// async { return Ok 42 }
```

### Example 2

```fsharp
let result = AsyncValidation.ofChoice (Choice2Of2 "error")
// async { return Error ["error"] }
```
