effect-io-ai

Package: effect
Module: Context

Context.Service.Identifier

Extracts the identifier, or requirement type, associated with a Context service key.

Example (Extracting a service identifier)

import { Context } from "effect"

const Database = Context.Service<{ query: (sql: string) => string }>(
  "Database"
)

// Extract the identifier type from a key
type DatabaseId = Context.Service.Identifier<typeof Database>
// DatabaseId is the identifier type

Signature

type Identifier<T> = T extends Key<infer I, infer _S> ? I : never

Source

Since v2.0.0