effect-io-ai

Package: effect
Module: Context

Context.makeUnsafe

Creates a Context from an existing service map.

When to use

Use when constructing a low-level Context from a trusted map whose lifecycle you control.

Gotchas

This is unsafe because later mutation of the provided map can affect the created Context. Prefer empty, make, add, or merge for normal Context construction.

Example (Creating a context from a map)

import { Context } from "effect"

// Create a context from a Map (unsafe)
const map = new Map([
  ["Logger", { log: (msg: string) => console.log(msg) }]
])

const context = Context.makeUnsafe(map)

Signature

declare const makeUnsafe: <Services = never>(mapUnsafe: ReadonlyMap<string, any>) => Context<Services>

Source

Since v4.0.0