Hyperlinkv0.9.0-beta.0

Hyperlink

Hyperlink.defaultconstsrc/Hyperlink.ts:1017
<const V>(
  value: [V] extends [(...args: never) => Promise<unknown>] ? never : V
): DefaultMethod<V>

Declare a single Tag-baked default in the contract — identical local and remote, no wire, no impl slot. Accepts a literal or a sync function (Promise-returning fns are a type error — async belongs in effect / effectFn or promise).

For multiple defaults, pipe defaults onto the Tag instead (bag keys widen Service at construction — yield* Tag sees them).

Layer/serve may override a Spec default at the provide site only (see ImplWithDefaultOverrides); the remote client always installs the Tag-baked value.

class Counter extends Hyperlink.Tag<Counter>()("counter", {
  current: Hyperlink.effect(Schema.Number),
  label: Hyperlink.default((n: number) => `count=${n}`),
  unit: Hyperlink.default("count"),
}) {}
Source src/Hyperlink.ts:10176 lines
const default_ = <const V>(
  value: [V] extends [(...args: never) => Promise<unknown>] ? never : V,
): DefaultMethod<V> => ({
  [DefaultMethodTypeId]: DefaultMethodTypeId,
  value: value as V,
});