effect-io-ai

Package: effect
Module: Redacted

Redacted.Redacted.Value

Extracts the underlying value type from a Redacted type.

When to use

Use to infer the sensitive value type from an existing Redacted type.

Example (Extracting the redacted value type)

import { Redacted } from "effect"

type ApiKey = Redacted.Redacted<{ readonly token: string }>
type ApiKeyValue = Redacted.Redacted.Value<ApiKey>

const rotate = (value: ApiKeyValue): ApiKeyValue => ({
  token: `${value.token}:rotated`
})

console.log(rotate({ token: "secret" })) // { token: "secret:rotated" }

Signature

type Value<T> = [T] extends [Redacted<infer _A>] ? _A : never

Source

Since v3.3.0