import { type Context, type FC, type ReactNode } from "react"; type ContextProvider = FC; type UseAssertedContext = (consumerName: string) => ContextValueType; interface UseContext { (consumerName: string): ContextValueType; (consumerName: string, options: { optional: true; }): ContextValueType | undefined; } /** * Creates a context with a custom provider and a hook to use the context. */ declare function createContext(rootComponentName: string): readonly [ContextProvider, UseContext]; declare function createContext(rootComponentName: string, defaultContext: ContextValueType): readonly [ ContextProvider, UseAssertedContext ]; type Scope = { [scopeName: string]: Context[]; } | undefined; type ScopeHook = (_scope: Scope) => { [__scopeProp: string]: Scope; }; interface CreateScope { scopeName: string; (): ScopeHook; } type ScopedContextProvider = FC; interface UseScopedContext { (consumerName: string, scope: Scope): ContextValueType; (consumerName: string, scope: Scope, options: { optional?: true; }): ContextValueType | undefined; } type UseAssertedScopedContext = (consumerName: string, scope: Scope) => ContextValueType; interface CreateScopedContext { (rootComponentName: string): readonly [ ScopedContextProvider, UseScopedContext ]; (rootComponentName: string, defaultContext: ContextValueType): readonly [ ScopedContextProvider, UseAssertedScopedContext ]; } /** * Creates a scoped context that can be composed with other scoped contexts. */ declare function createContextScope(scopeName: string, createContextScopeDeps?: CreateScope[]): readonly [CreateScopedContext, CreateScope]; export type { CreateScope, CreateScopedContext, Scope, UseAssertedContext, UseAssertedScopedContext, UseContext, UseScopedContext, }; export { createContext, createContextScope };