<A>(self: A | undefined): AReturns the defined value, or throws a default Error when the input is
undefined.
When to use
Use when you need to unwrap a value that should already be defined and a
generic missing-value Error is acceptable.
Details
Defined inputs are returned unchanged. undefined throws
new Error("getOrThrow called on a undefined").
Source effect/UndefinedOr.ts:1183 lines
export const const getOrThrow: <A>(
self: A | undefined
) => A
Returns the defined value, or throws a default Error when the input is
undefined.
When to use
Use when you need to unwrap a value that should already be defined and a
generic missing-value Error is acceptable.
Details
Defined inputs are returned unchanged. undefined throws
new Error("getOrThrow called on a undefined").
getOrThrow: <function (type parameter) A in <A>(self: A | undefined): AA>(self: A | undefinedself: function (type parameter) A in <A>(self: A | undefined): AA | undefined) => function (type parameter) A in <A>(self: A | undefined): AA = const getOrThrowWith: (onUndefined: () => unknown) => <A>(self: A | undefined) => A (+1 overload)getOrThrowWith(() =>
new var Error: ErrorConstructor
new (message?: string, options?: ErrorOptions) => Error (+1 overload)
Error("getOrThrow called on a undefined")
)