import { Context as CoolContext, useContext as useCoolContext } from "react"; export function useContext( context: CoolContext, name: string, hint?: string ): TContext { const $context = useCoolContext(context); if (!$context) { throw new Error( `There is no [${name}] context available.${ hint ? ` ${hint}` : "" } ` ); } return $context; }