import { AsyncLocalStorage } from "node:async_hooks"; interface UseContext { /** * Get the current context. Throws if no context is set. */ use: () => T; /** * Get the current context. Returns `null` when no context is set. */ tryUse: () => T | null; /** * Set the context as Singleton Pattern. */ set: (instance?: T, replace?: boolean) => void; /** * Clear current context. */ unset: () => void; /** * Exclude a synchronous function with the provided context. */ call: (instance: T, callback: () => R) => R; /** * Exclude an asynchronous function with the provided context. * Requires installing the transform plugin to work properly. */ callAsync: (instance: T, callback: () => R | Promise) => Promise; } export { UseContext };