effect-io-ai

Package: effect
Module: Context

Context.make

Creates a new Context with a single service associated to the key.

Example (Creating a context with one service)

import { Context } from "effect"
import * as assert from "node:assert"

const Port = Context.Service<{ PORT: number }>("Port")

const context = Context.make(Port, { PORT: 8080 })

assert.deepStrictEqual(Context.get(context, Port), { PORT: 8080 })

Signature

declare const make: <I, S>(key: Key<I, S>, service: Types.NoInfer<S>) => Context<I>

Source

Since v2.0.0