shelving
Version:
Toolkit for using data in JavaScript.
7 lines (6 loc) • 469 B
TypeScript
import { type Context } from "react";
import type { AnyCaller } from "../../util/function.js";
/** Use the value of a React `Context`, or throw `RequiredError` if the context was unset. */
export declare function requireContext<T>(context: Context<T | null>, caller?: AnyCaller): T;
export declare function requireContext<T>(context: Context<T | undefined>, caller?: AnyCaller): T;
export declare function requireContext<T>(context: Context<T>, caller?: AnyCaller): T;