type DefaultContext = Object; type GetContext = () => T; type SetContext = (data: Partial) => void; export interface Context { /** Run a callback with a specific context. */ provider: (initialValue: T, callback: () => void) => void; /** Get the context. */ getContext: GetContext; /** Partially update the context. */ setContext: SetContext; } interface CreateContextOptions { name: string; } /** * Create context allows you to create scoped variables for fucntions. * Similar to React's context API. * Usage: * ```ts * interface MyContext { * value: string; * } * * const context = createContext({ name: "my-context" }); * * context.provider({ * value: "hello", * }, () => { * // Do something with the context * })``` */ export declare function createContext({ name, }: CreateContextOptions): Context; export {};