diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index 2f1ad8b7be..93fa2c9c6a 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -107,6 +107,8 @@ export interface TypeaheadContainerProps { text: string; } +export type TypeaheadResult = T & { customOption: boolean }; + export interface TypeaheadProps { /* For localized accessibility: Should return a string indicating the number of results for screen readers. Receives the current results. */ @@ -252,10 +254,10 @@ export interface TypeaheadProps { placeholder?: string; /* Callback for custom menu rendering. */ - renderMenu?: (results: T[], menuProps: any) => React.ReactNode; + renderMenu?: (results: Array>, menuProps: any) => React.ReactNode; /* Provides a hook for customized rendering of menu item contents. */ - renderMenuItemChildren?: (option: T, props: TypeaheadMenuProps, index: number) => React.ReactNode; + renderMenuItemChildren?: (option: TypeaheadResult, props: TypeaheadMenuProps, index: number) => React.ReactNode; /* Provides a hook for customized rendering of tokens when multiple selections are enabled. */ renderToken?: (selectedItem: T, props: TypeaheadMenuProps, index: number) => React.ReactNode; diff --git a/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx b/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx index 7e2c3a29a6..f331752cbb 100644 --- a/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx +++ b/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx @@ -107,6 +107,21 @@ class BasicExample extends React.Component { } /> + ( + + { results.map((result, index) => ( + + { result.customOption && 'New: ' } + {result.name} + + )) } + + )} + />