moroshko / react-autosuggest

WAI-ARIA compliant React autosuggest component
http://react-autosuggest.js.org
MIT License
5.97k stars 586 forks source link

Faulty declaration with sections in @types/react-autosuggest #617

Open mienaikoe opened 5 years ago

mienaikoe commented 5 years ago

in https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-autosuggest/index.d.ts

The suggestions prop is defined as:

suggestions: TSuggestion[];

However, the documentation states that suggestions can take the shape of an array of sections. But if you assume a section is a TSuggestion, then none of the other methods work as they think a section is actually a suggestion.

You should make this type definition: suggestions: any[] to support sections, or make a new prop specifically for sections.

HoldYourWaffle commented 5 years ago

You should make this type definition: suggestions: any[] to support sections

Why would an any type be necessary here?