| 246 | const self = KeyClass as any as Types.Mutable<Reference<any>> |
| 247 | Object.setPrototypeOf(self, ServiceProto) |
| 248 | const init = (key: string, options?: { |
| 249 | readonly defaultValue?: any |
| 250 | readonly make?: any |
| 251 | readonly fiberCached?: boolean |
| 252 | }) => { |
| 253 | self.key = key |
| 254 | if (options?.defaultValue) { |
| 255 | self[ReferenceTypeId] = ReferenceTypeId |
| 256 | self.defaultValue = options.defaultValue |
| 257 | } |
| 258 | if (options?.make) { |
| 259 | ;(self as any).make = options.make |
| 260 | } |
| 261 | if (options?.fiberCached) { |
| 262 | cacheKeys.add(key) |
| 263 | } |
| 264 | return self |
| 265 | } |
| 266 | return arguments.length > 0 ? init(arguments[0], arguments[1]) : init |
| 267 | } as any |
| 268 | |