MCPcopy Create free account
hub / github.com/Effect-TS/effect / Reference

Function Reference

packages/effect/src/internal/context.ts:104–123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

102
103/** @internal */
104export const Reference = <Self>() =>
105<const Id extends string, Service>(id: Id, options: {
106 readonly defaultValue: () => Service
107}): C.ReferenceClass<Self, Id, Service> => {
108 const limit = getStackTraceLimit()
109 setStackTraceLimit(2)
110 const creationError = new Error()
111 setStackTraceLimit(limit)
112
113 function ReferenceClass() {}
114 Object.setPrototypeOf(ReferenceClass, ReferenceProto)
115 ReferenceClass.key = id
116 ReferenceClass.defaultValue = options.defaultValue
117 Object.defineProperty(ReferenceClass, "stack", {
118 get() {
119 return creationError.stack
120 }
121 })
122 return ReferenceClass as any
123}
124
125/** @internal */
126export const TypeId: C.TypeId = Symbol.for("effect/Context") as C.TypeId

Callers

nothing calls this directly

Calls 2

getStackTraceLimitFunction · 0.70
setStackTraceLimitFunction · 0.70

Tested by

no test coverage detected