Hyperlinkv0.8.0-beta.28

Option

Option.asVoidconsteffect/Option.ts:1224
<_>(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' }
mappingas
Source effect/Option.ts:12241 lines
export const asVoid: <_>(self: Option<_>) => Option<void> = as(undefined)