diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index fa970bc5b3..d0bfcea9a7 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -3,12 +3,23 @@ // Definitions by: Guymestef // Rajab Shakirov // Paito Anderson +// Andreas Richter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 // TODO: , , , components import * as React from 'react'; +export interface TypeaheadFilterbyProps { + filterBy: string[]; + labelKey: (string | (() => void)); + multiple: boolean; + selected: any[]; + caseSensitive: boolean; + ignoreDiacritics: boolean; + text: string; +} + export interface TypeaheadProps { /* For localized accessibility: Should return a string indicating the number of results for screen readers. Receives the current results. */ a11yNumResults?: () => void; @@ -58,7 +69,7 @@ export interface TypeaheadProps { emptyLabel?: string; /* Either an array of fields in option to search, or a custom filtering callback. */ - filterBy?: (string[] | ((option: T | string, text: string) => boolean)); + filterBy?: (string[] | ((option: T | string, props: TypeaheadFilterbyProps) => boolean)); /* Highlights the menu item if there is only one result and allows selecting that item by hitting enter. Does not work with allowNew. */ diff --git a/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx b/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx index 10237b1fa0..6c9143dfea 100644 --- a/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx +++ b/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx @@ -28,6 +28,14 @@ class BasicExample extends React.Component { onInputChange={(value, e) => {}} placeholder="Choose a state..." /> + (props.text.indexOf(option) !== -1) } + placeholder="Choose a state..." + /> ); }