1- import React , { createContext , PropsWithChildren , useContext } from 'react' ;
1+ import React , { createContext , useContext } from 'react' ;
2+ import type { PropsWithChildren } from 'react' ;
23import type { SearchController } from 'stream-chat' ;
3- import type { DefaultStreamChatGenerics } from '../../types' ;
44
5- export type SearchContextValue <
6- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
7- > = {
5+ export type SearchContextValue = {
86 /** The type of channel to create on user result select, defaults to `messaging` */
97 directMessagingChannelType : string ;
108 /** Instance of the search controller that handles the data management */
11- searchController : SearchController < StreamChatGenerics > ;
9+ searchController : SearchController ;
1210 /** Sets the input element into disabled state */
1311 disabled ?: boolean ;
1412 /** Clear search state / results on every click outside the search input, defaults to true */
@@ -22,22 +20,18 @@ export const SearchContext = createContext<SearchContextValue | undefined>(undef
2220/**
2321 * Context provider for components rendered within the `Search` component
2422 */
25- export const SearchContextProvider = <
26- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
27- > ( {
23+ export const SearchContextProvider = ( {
2824 children,
2925 value,
3026} : PropsWithChildren < {
31- value : SearchContextValue < StreamChatGenerics > ;
27+ value : SearchContextValue ;
3228} > ) => (
3329 < SearchContext . Provider value = { value as unknown as SearchContextValue } >
3430 { children }
3531 </ SearchContext . Provider >
3632) ;
3733
38- export const useSearchContext = <
39- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
40- > ( ) => {
34+ export const useSearchContext = ( ) => {
4135 const contextValue = useContext ( SearchContext ) ;
42- return contextValue as unknown as SearchContextValue < StreamChatGenerics > ;
36+ return contextValue as unknown as SearchContextValue ;
4337} ;
0 commit comments