diff --git a/src/Results.tsx b/src/Results.tsx index 984031c..8880a46 100644 --- a/src/Results.tsx +++ b/src/Results.tsx @@ -26,7 +26,7 @@ interface Props { // optional row override style rowStyle?: React.CSSProperties; // optional result renderering function - resultRenderer?: (item: T) => React.ReactChild; + resultRenderer?: Omnibar.ResultRenderer; } const LIST_STYLE: React.CSSProperties = { diff --git a/src/ResultsItem.tsx b/src/ResultsItem.tsx index 3a3043b..a5eaaa7 100644 --- a/src/ResultsItem.tsx +++ b/src/ResultsItem.tsx @@ -10,13 +10,13 @@ interface Props { // onMouseLeave item callback onMouseLeave?: (e: any /* Event */) => void; // onClick callback - onClickItem: (e: any /* Event */) => void; + onClickItem?: (e: any /* Event */) => void; // set to true to highlight the given item highlighted?: boolean; // optional style override style?: React.CSSProperties; // optional result renderering function - resultRenderer?: (item: T) => React.ReactChild; + resultRenderer?: Omnibar.ResultRenderer; } interface State { @@ -73,7 +73,7 @@ export default class ResultRenderer extends React.PureComponent< const renderer = this.props.resultRenderer ? this.props.resultRenderer - : AnchorRenderer; + : AnchorRenderer as Omnibar.ResultRenderer; return (
  • = (query: string) => Results; type Extension = FunctionalExtension; + // Renderers + type ResultRenderer = ({ item }: { item: T }) => JSX.Element; + interface Props { // list of extensions extensions: Array>; @@ -32,7 +35,7 @@ declare namespace Omnibar { // options style on the root element rootStyle?: React.CSSProperties; // optional result renderering function - resultRenderer?: (item: T) => React.ReactChild; + resultRenderer?: ResultRenderer; // optional action override onAction?: (item: T) => void; // optional input delay override