effect-io-ai

Package: effect
Module: Context

Context.isContext

Checks whether the provided argument is a Context.

When to use

Use to narrow an unknown value before passing it to APIs that require a Context.

Details

This checks the runtime Context marker and does not inspect which services the context contains.

Gotchas

This guard only proves that the value is a Context; it does not prove that any specific service is present.

Example (Checking for contexts)

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

assert.strictEqual(Context.isContext(Context.empty()), true)

See

Signature

declare const isContext: (u: unknown) => u is Context<never>

Source

Since v2.0.0