effect-io-ai

Package: effect
Module: TxRef

TxRef.makeUnsafe

Creates a new TxRef synchronously with the specified initial value.

When to use

Use to construct a TxRef synchronously when it must be created outside an Effect workflow.

Example (Creating transactional references unsafely)

import { TxRef } from "effect"

// Create a TxRef synchronously (unsafe - use make instead in Effect contexts)
const counter = TxRef.makeUnsafe(0)
const config = TxRef.makeUnsafe({ timeout: 5000, retries: 3 })

// These are now ready to use in transactions
console.log(counter.value) // 0
console.log(config.value) // { timeout: 5000, retries: 3 }

Signature

declare const makeUnsafe: <A>(initial: A) => TxRef<A>

Source

Since v4.0.0