effect-io-ai

Package: effect
Module: Data

Data.TaggedEnum.Value

Extracts the full variant type (including _tag) for a specific tag.

When to use

Use to select one full tagged-union variant by its _tag value.

Example (Extracting a variant type)

import type { Data } from "effect"

type Result =
  | { readonly _tag: "Ok"; readonly value: number }
  | { readonly _tag: "Err"; readonly error: string }

type OkVariant = Data.TaggedEnum.Value<Result, "Ok">
// { readonly _tag: "Ok"; readonly value: number }

See

Signature

type Value<A, K> = Extract<A, { readonly _tag: K }>

Source

Since v2.0.0