Extracts the success value from a Result or ResultAsync.
If the input is a Failure, it will throw the error or return the default value if provided.
The input Result or ResultAsync.
The default value type (optional).
assertSuccess - When used with assertSuccess, you can safely unwrap the Result.
unwrap<
R
>(result
):true
extendsHasPromise
<R
> ?Promise
<InferSuccess
<R
>> :InferSuccess
<R
>
Defined in: functions/unwrap.ts:56
R
extends ResultMaybeAsync
<any
, any
>
R
true
extends HasPromise
<R
> ? Promise
<InferSuccess
<R
>> : InferSuccess
<R
>
unwrap<
R
,T
>(result
,defaultValue
):true
extendsHasPromise
<R
> ?Promise
<T
|InferSuccess
<R
>> :T
|InferSuccess
<R
>
Defined in: functions/unwrap.ts:57
R
extends ResultMaybeAsync
<any
, any
>
T
R
T
true
extends HasPromise
<R
> ? Promise
<T
| InferSuccess
<R
>> : T
| InferSuccess
<R
>
unwrap<
R
>(): (result
) =>true
extendsHasPromise
<R
> ?Promise
<InferSuccess
<R
>> :InferSuccess
<R
>
Defined in: functions/unwrap.ts:58
R
extends ResultMaybeAsync
<any
, any
>
(
result
):true
extendsHasPromise
<R
> ?Promise
<InferSuccess
<R
>> :InferSuccess
<R
>
R
true
extends HasPromise
<R
> ? Promise
<InferSuccess
<R
>> : InferSuccess
<R
>
unwrap<
R
,T
>(defaultValue
): (result
) =>true
extendsHasPromise
<R
> ?Promise
<T
|InferSuccess
<R
>> :T
|InferSuccess
<R
>
Defined in: functions/unwrap.ts:59
R
extends ResultMaybeAsync
<any
, any
>
T
T
(
result
):true
extendsHasPromise
<R
> ?Promise
<T
|InferSuccess
<R
>> :T
|InferSuccess
<R
>
R
true
extends HasPromise
<R
> ? Promise
<T
| InferSuccess
<R
>> : T
| InferSuccess
<R
>