Hyperlinkv0.8.0-beta.28

Hyperlink

Hyperlink.ImplOftypesrc/Hyperlink.ts:1922
ImplOf<S>

The implementation a localLayer / serve expects: wire members are their Effect/Stream/function, and each LocalMethod is its raw value T (the toolkit wraps it to require the Local). When an impl needs a capability (e.g. peers) to build, provide it via the Effect form of Hyperlink.layer / Hyperlink.serve — resolve it once, and the members close over it.

A value field's impl is the Stream that feeds it (typically a SubscriptionRef's .changes), and a constant's is the Effect<A> resolved once — both differ from how they surface in ServiceOf (a plain A), so annotate an impl with ImplOf, not ServiceOf.

modelslocalLayerserveLocalMethodLocalpeersHyperlink.layerHyperlink.serveServiceOf
Source src/Hyperlink.ts:192213 lines
export type ImplOf<S extends Spec> = {
  readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M>
    ? M // fromService local: the impl provides the interface member itself
    : S[K] extends LocalMethod<infer T>
    ? T
    : S[K] extends { readonly _tag: "ref" }
      ? Subscribable<SuccessOf<AsMethod<S[K]>>> // impl owns the SubscriptionRef, provided via subscribable()
      : S[K] extends { readonly kind: MethodKind }
        ? ServiceMethod<AsMethod<S[K]>>
        : S[K] extends Spec
          ? ImplOf<S[K]> // nested group → nested impl
          : never;
};
Referenced by 10 symbols