()
| 102 | |
| 103 | /** @internal */ |
| 104 | export 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 */ |
| 126 | export const TypeId: C.TypeId = Symbol.for("effect/Context") as C.TypeId |
nothing calls this directly
no test coverage detected