jQuery-Autocomplete icon indicating copy to clipboard operation
jQuery-Autocomplete copied to clipboard

Types definition for suggestions possibly out of date

Open kahlan88 opened this issue 5 years ago • 1 comments

I can see that suggestions allow AutocompleteSuggestion[] only

interface AutocompleteResponse {
    suggestions: AutocompleteSuggestion[];
}

The docs state that suggestions can also be an array of strings like so:

{
    "query": "Unit",
    "suggestions": ["United Arab Emirates", "United Kingdom", "United States"]
}

I think it should therefore be:

interface AutocompleteResponse {
    suggestions: AutocompleteSuggestion[] | string[];
}

Am I correct? Is this something that could be added? If so, I would be happy to, if someone could point me to the right place to add them (would it be in this project or somewhere in DefinitelyTyped)? It seems like types have been written for jQuery-Autocomplete 1.2.25 and I'm looking at 1.4.10.

kahlan88 avatar Feb 26 '20 11:02 kahlan88

You are correct. Typings can be updated. In terms of versioning, I think it is safe to use typings with 1.4, contract has not changed.

Feel free to update: https://github.com/devbridge/jQuery-Autocomplete/blob/master/typings/jquery-autocomplete/jquery.autocomplete.d.ts and issue PR.

tkirda avatar Mar 09 '20 14:03 tkirda