ResultAsync missing _unsafeUnwrap() and _unsafeUnwrapErr() test utilities

Author: BinilkksCreated Jun 26, 2026Updated Jun 26, 2026

Feature Request: Add _unsafeUnwrap() and _unsafeUnwrapErr() to ResultAsync

Problem

Result provides two test utilities for quickly unwrapping values in test environments:

typescript
result._unsafeUnwrap()    // returns T or throws
result._unsafeUnwrapErr() // returns E or throws

ResultAsync has no equivalent. Users must always await first and then call the methods on the resolved Result, which is more verbose in tests:

typescript
// Current — two steps required
const res = await myResultAsync
const value = res._unsafeUnwrap()

// Desired — one step
const value = await myResultAsync._unsafeUnwrap()

Impact

This asymmetry is particularly annoying in test code where you're doing many assertions on ResultAsync values. Every assertion requires an intermediate await before you can check the value.

Suggested Implementation

typescript
// In ResultAsync class
async _unsafeUnwrap(config?: ErrorConfig): Promise<T> {
  return this._promise.then((res) => res._unsafeUnwrap(config))
}

async _unsafeUnwrapErr(config?: ErrorConfig): Promise<E> {
  return this._promise.then((res) => res._unsafeUnwrapErr(config))
}

This mirrors the existing unwrapOr pattern already on ResultAsync:

typescript
unwrapOr<A>(t: A): Promise<T | A> {
  return this._promise.then((res) => res.unwrapOr(t))
}

Consistency Table

Method Result ResultAsync
unwrapOr()
match()
_unsafeUnwrap()
_unsafeUnwrapErr()