MCPcopy Create free account
hub / github.com/effect-app/libs / accessFn

Function accessFn

packages/effect-app/src/Context.ts:67–75  ·  view source on GitHub ↗
(
  Tag: Opaque<Self, Shape>,
  key: K
)

Source from the content-addressed store, hash-verified

65
66/** Accessor for a service method that returns a plain value. Wraps via `useSync`. */
67export const accessFn = <
68 Self extends object,
69 Shape extends Record<PropertyKey, any>,
70 K extends keyof Shape
71>(
72 Tag: Opaque<Self, Shape>,
73 key: K
74): Shape[K] extends (...args: [...infer Args]) => infer A ? (...args: Readonly<Args>) => Effect.Effect<A, never, Self>
75 : never => ((...args: Array<any>) => Tag.useSync((s: any) => s[key](...args))) as any
76
77/** Accessor for a service method that returns an Effect. Delegates via `use`. */
78export const accessEffectFn = <

Callers 1

I18nClass · 0.90

Calls 1

useSyncMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…