Extracts the value from a successful result, or throws the error.
The result to unwrap.
The success value.
The original failure value, including values that are not Error instances.
Error
The ok discriminant controls unwrapping; falsy and nullish success values are returned unchanged.
ok
resultUnwrap({ ok: true, value: 42 }); // 42resultUnwrap({ ok: false, error: e }); // throws e Copy
resultUnwrap({ ok: true, value: 42 }); // 42resultUnwrap({ ok: false, error: e }); // throws e
Extracts the value from a successful result, or throws the error.