@@ -67,7 +67,7 @@ import type {
6767 SearchSourceResultListProps ,
6868} from '../experimental' ;
6969
70- import type { PropsWithChildrenOnly , UnknownType } from '../types/types' ;
70+ import type { PropsWithChildrenOnly } from '../types/types' ;
7171import type { StopAIGenerationButtonProps } from '../components/MessageInput/StopAIGenerationButton' ;
7272import type { ShareLocationDialogProps } from '../components/Location' ;
7373import type { VideoPlayerProps } from '../components/VideoPlayer' ;
@@ -276,26 +276,3 @@ export const useComponentContext = (
276276 // eslint-disable-next-line @typescript-eslint/no-unused-vars
277277 _componentName ?: string ,
278278) => useContext ( ComponentContext ) as unknown as ComponentContextValue ;
279-
280- /**
281- * Typescript currently does not support partial inference, so if ComponentContext
282- * typing is desired while using the HOC withComponentContext, the Props for the
283- * wrapped component must be provided as the first generic.
284- */
285- export const withComponentContext = < P extends UnknownType > (
286- Component : React . ComponentType < P > ,
287- ) => {
288- const WithComponentContextComponent = ( props : Omit < P , keyof ComponentContextValue > ) => {
289- const componentContext = useComponentContext ( ) ;
290-
291- return < Component { ...( props as P ) } { ...componentContext } /> ;
292- } ;
293-
294- WithComponentContextComponent . displayName = (
295- Component . displayName ||
296- Component . name ||
297- 'Component'
298- ) . replace ( 'Base' , '' ) ;
299-
300- return WithComponentContextComponent ;
301- } ;
0 commit comments