effect-io-ai

Package: effect
Module: Context

Context.Service.Shape

Extracts the service implementation type stored behind a Context service key.

Example (Extracting a service shape)

import { Context } from "effect"

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

// Extract the service shape from the service
type DatabaseService = Context.Service.Shape<typeof Database>
// DatabaseService is { query: (sql: string) => string }

Signature

type Shape<T> = T extends Key<infer _I, infer S> ? S : never

Source

Since v4.0.0