(name: string)
| 8 | } |
| 9 | |
| 10 | export function create<T>(name: string) { |
| 11 | const storage = new AsyncLocalStorage<T>() |
| 12 | return { |
| 13 | use() { |
| 14 | const result = storage.getStore() |
| 15 | if (!result) { |
| 16 | throw new NotFound(name) |
| 17 | } |
| 18 | return result |
| 19 | }, |
| 20 | provide<R>(value: T, fn: () => R) { |
| 21 | return storage.run(value, fn) |
| 22 | }, |
| 23 | } |
| 24 | } |
| 25 | } |
nothing calls this directly
no outgoing calls
no test coverage detected