import { useContext } from 'react'; import PonyfillContext from './PonyfillContext'; import type { Context } from 'react'; type ContextOf = T extends Context ? C : never; export default function usePonyfillContext(): Exclude, undefined> { const context = useContext(PonyfillContext); if (!context) { throw new Error('botframework-webchat: This hook can only be used under .'); } return context; }