const result: Result<number, string> = err("error");
const value = unwrapForced(result); // undefined
const result: Promise<Result<number, string>> = Promise.resolve(ok(1));
const value: Promise<number> = unwrapForced(result); // Promise<1>
const result: Promise<Result<number, string>> = Promise.resolve(err("error"));
const value: Promise<undefined> = unwrapForced(result); // Promise<undefined>
Force unwrap a result. You probably shouldn't use this function and use unwrap or unwrapErr instead.
If the result is an Ok, it will return the value.
If the result is an Err, it will return undefined.
const result: Result<number, string> = err("error");
const value = unwrapForced(result); // undefined
const result: Promise<Result<number, string>> = Promise.resolve(ok(1));
const value: Promise<number> = unwrapForced(result); // Promise<1>
const result: Promise<Result<number, string>> = Promise.resolve(err("error"));
const value: Promise<undefined> = unwrapForced(result); // Promise<undefined>
Force unwrap a result. You probably shouldn't use this function and use unwrap or unwrapErr instead.
If the result is an Ok, it will return the value.
If the result is an Err, it will return undefined.
const result: Result<number, string> = err("error");
const value = unwrapForced(result); // undefined
const result: Promise<Result<number, string>> = Promise.resolve(ok(1));
const value: Promise<number> = unwrapForced(result); // Promise<1>
const result: Promise<Result<number, string>> = Promise.resolve(err("error"));
const value: Promise<undefined> = unwrapForced(result); // Promise<undefined>
Force unwrap a result. You probably shouldn't use this function and use unwrap or unwrapErr instead.
If the result is an Ok, it will return the value.
If the result is an Err, it will return undefined.
const result: Result<number, string> = err("error");
const value = unwrapForced(result); // undefined
const result: Promise<Result<number, string>> = Promise.resolve(ok(1));
const value: Promise<number> = unwrapForced(result); // Promise<1>
const result: Promise<Result<number, string>> = Promise.resolve(err("error"));
const value: Promise<undefined> = unwrapForced(result); // Promise<undefined>
Force unwrap a result. You probably shouldn't use this function and use unwrap or unwrapErr instead.
If the result is an Ok, it will return the value.
If the result is an Err, it will return undefined.
const result: Result<number, string> = err("error");
const value = unwrapForced(result); // undefined
const result: Promise<Result<number, string>> = Promise.resolve(ok(1));
const value: Promise<number> = unwrapForced(result); // Promise<1>
const result: Promise<Result<number, string>> = Promise.resolve(err("error"));
const value: Promise<undefined> = unwrapForced(result); // Promise<undefined>
Force unwrap a result. You probably shouldn't use this function and use unwrap or unwrapErr instead.
If the result is an Ok, it will return the value.
If the result is an Err, it will return undefined.
const result: Result<number, string> = err("error");
const value = unwrapForced(result); // undefined
const result: Promise<Result<number, string>> = Promise.resolve(ok(1));
const value: Promise<number> = unwrapForced(result); // Promise<1>
const result: Promise<Result<number, string>> = Promise.resolve(err("error"));
const value: Promise<undefined> = unwrapForced(result); // Promise<undefined>
Force unwrap a result. You probably shouldn't use this function and use unwrap or unwrapErr instead.
If the result is an
Ok, it will return the value.If the result is an
Err, it will returnundefined.