function unwrap
Since 0.1.0
unwrap<T, E>(result: Result<T, E>): T

Unwraps a Result, returning the value or throwing the error.

Prefer narrowing with the success discriminant; reserve unwrap for contexts where failure is a programming error.

Type Parameters

The success value type

The error type

Parameters

result: Result<T, E>

The result to unwrap

Return Type

The success value

Throws

The Err error value when the result is a failure

Usage

import { unwrap } from "common/src/index.ts";