Package: effect
Module: Context
Typed identifier for a service stored in a Context.
When to use
Use as the typed handle for storing, retrieving, and requiring a specific
service in a Context.
Details
Identifier tracks the requirement in Effect types, while Shape is the
service implementation retrieved by the key. A key is also an Effect value,
so yielding it inside Effect.gen retrieves the service from the current
fiber context.
See
Service for creating required service keysReference for creating service keys with default valuesSignature
export interface Key<out Identifier, out Shape> extends Effect<Shape, never, Identifier> {
readonly [ServiceTypeId]: ServiceTypeId
readonly Service: Shape
readonly Identifier: Identifier
readonly key: string
readonly stack?: string | undefined
}
Since v4.0.0