effect-io-ai

Package: effect
Module: UndefinedOr

UndefinedOr.getOrThrowWith

Returns the defined value, or throws the value produced by onUndefined when the input is undefined.

When to use

Use when you need fail-fast unwrapping of an A | undefined value and want to provide the thrown error for the undefined case.

Details

Defined values are returned unchanged. When the input is undefined, onUndefined is called and its result is thrown.

See

Signature

declare const getOrThrowWith: { (onUndefined: () => unknown): <A>(self: A | undefined) => A; <A>(self: A | undefined, onUndefined: () => unknown): A; }

Source

Since v4.0.0