import type { Context } from "react"; import { createContext } from "react"; export type NamedContext = Context & Required, "displayName">>; export function createNamedContext(displayName: string, defaultValue: T) { const context = createContext(defaultValue); context.displayName = displayName; return context as NamedContext; }