Hyperlinkv0.8.0-beta.28

Context

Context.ServiceClassinterfaceeffect/Context.ts:124
ServiceClass<Self, Identifier, Shape>

Class-style service key produced by Context.Service<Self, Shape>()("Id").

When to use

Use when declaring a service as a class so the class value can serve as the Context key.

Details

The class itself is the Context key, and its string key identifies the service at runtime.

modelsService
Source effect/Context.ts:12427 lines
export interface ServiceClass<in out Self, in out Identifier extends string, in out Shape>
  extends Service<Self, Shape>
{
  new(_: never): ServiceClass.Shape<Identifier, Shape>
  readonly key: Identifier
}

/**
 * Namespace containing helper types for class-style `Context.Service`
 * declarations.
 *
 * @since 4.0.0
 */
export declare namespace ServiceClass {
  /**
   * Runtime and type-level metadata carried by a class-style service key,
   * including its service type identifier, string key, and service shape.
   *
   * @category models
   * @since 4.0.0
   */
  export interface Shape<Identifier extends string, Service> {
    readonly [ServiceTypeId]: typeof ServiceTypeId
    readonly key: Identifier
    readonly Service: Service
  }
}
Referenced by 7 symbols