<_>(self: Option<_>): Option<void>Replaces the value inside a Some with void (undefined), leaving None
unchanged.
When to use
Use when you need to discard a present Option value while preserving
whether it was Some or None.
Example (Voiding the value)
import { Option } from "effect"
console.log(Option.asVoid(Option.some(42)))
// Output: { _id: 'Option', _tag: 'Some', value: undefined }
console.log(Option.asVoid(Option.none()))
// Output: { _id: 'Option', _tag: 'None' }export const const asVoid: <_>(
self: Option<_>
) => Option<void>
Replaces the value inside a Some with void (undefined), leaving None
unchanged.
When to use
Use when you need to discard a present Option value while preserving
whether it was Some or None.
Example (Voiding the value)
import { Option } from "effect"
console.log(Option.asVoid(Option.some(42)))
// Output: { _id: 'Option', _tag: 'Some', value: undefined }
console.log(Option.asVoid(Option.none()))
// Output: { _id: 'Option', _tag: 'None' }
asVoid: <function (type parameter) _ in <_>(self: Option<_>): Option<void>_>(self: Option<_>self: type Option<A> = None<A> | Some<A>The Option data type represents optional values. An Option<A> is either
Some<A>, containing a value of type A, or None, representing absence.
When to use
Use to represent initial values that may not yet exist
- Returning from partial functions (not defined for all inputs)
- Managing optional fields in data structures
Namespace containing utility types for Option.
When to use
Use to access type-level helpers associated with Option.
Option<function (type parameter) _ in <_>(self: Option<_>): Option<void>_>) => type Option<A> = None<A> | Some<A>The Option data type represents optional values. An Option<A> is either
Some<A>, containing a value of type A, or None, representing absence.
When to use
Use to represent initial values that may not yet exist
- Returning from partial functions (not defined for all inputs)
- Managing optional fields in data structures
Namespace containing utility types for Option.
When to use
Use to access type-level helpers associated with Option.
Option<void> = const as: {
<B>(b: B): <X>(self: Option<X>) => Option<B>
<X, B>(self: Option<X>, b: B): Option<B>
}
as(var undefinedundefined)