Hyperlinkv0.8.0-beta.28

Store

Store.provideContextconstsrc/Store.ts:1379
<Effects extends StoreEffectsVariance<StoreContractValue>, Ctx>(
  effects: Effects,
  context: Context.Context<Ctx>
): StoreProvidedContext<Effects, Ctx>

Provide a Context.Context to every method of an effects object — the one-liner that replaces a repetitive per-method Effect.provideContext(...) wrapping. One-liner over mapEffects, exactly parallel to catchWriteErrors; the result subtracts the provided context Ctx from each method's requirement (see StoreProvidedContext) — RExclude<R, Ctx> — so an effects object whose only requirement is Storage becomes the Storage-free shape a downstream consumer expects, while a method needing more than Ctx provides keeps a residual requirement (caught at the assignment) rather than a false never. Providing the context to a method that carries no matching R is a harmless no-op, so it applies uniformly.

const storageContext = yield* Effect.context<Store.Storage>();
const store = Store.provideContext(storeEffects, storageContext); // methods become Effect<void>
Source src/Store.ts:137910 lines
export const provideContext = <
  Effects extends StoreEffectsVariance<StoreContractValue>,
  Ctx,
>(
  effects: Effects,
  context: Context.Context<Ctx>,
): StoreProvidedContext<Effects, Ctx> =>
  mapEffects<Effects, StoreProvidedContext<Effects, Ctx>>(effects, (effect) =>
    Effect.provideContext(effect as any, context) as any,
  );