import type { Context } from '../context.ts' import { inject } from '../context.ts' /** * React-style alias for inject * * @example * ```ts * const theme = useContext(ThemeContext) // type is inferred from ThemeContext * ``` */ export function useContext(key: Context): T export function useContext(key: Context, defaultValue: TValue): NonNullable | TValue export function useContext(key: Context, defaultValue?: T): T { return inject(key, defaultValue) }