Procházet zdrojové kódy

Fix Generic type conflic in RecipeSearch

Tatiana Inama před 6 roky
rodič
revize
50c4dabe19

+ 2 - 2
recipes/src/components/List/index.tsx

@@ -6,7 +6,7 @@ import './styles.scss';
 
 type ItemProps = { focused?: boolean } ;
 
-type ListProps<T extends ItemProps> = {
+type ListProps<T> = {
   nonInteractive?: boolean,
   focusOnClick?: boolean,
   dense?: boolean,
@@ -17,7 +17,7 @@ type ListProps<T extends ItemProps> = {
   onClick?: (item: T, index: number) => void,
 }
 
-const CBKList = <T extends ItemProps>(props: ListProps<T>) => {
+const CBKList = <T extends any>(props: ListProps<T>) => {
   return (
     <ul className={
       classnames({

+ 2 - 2
recipes/src/components/RecipeSearch/index.tsx

@@ -112,11 +112,11 @@ class RecipeSearch extends React.Component<Props, State> {
         {
           results.length && openResult ? (
           <div className='cbk-recipe-search__results'>
-            <List
+            <List<DBRecipe>
               dense
               items={results}
               focus={cursor}
-              render={recipe => (
+              render={(recipe: DBRecipe) => (
                 <div
                   className='cbk-recipe-search__results__item'
                   onClick={() => this.selectRecipe(recipe)}