-
-
Notifications
You must be signed in to change notification settings - Fork 351
Description
Docs feedback
How can we improve Base UI documentation?
The documentation at
https://base-ui.com/react/components/autocomplete#typescript-inference
currently states:
If using
itemToStringValue, the value prop on the<Autocomplete.Item>must match the type of an item in theitemsarray.
This wording is potentially misleading. The value prop on <Autocomplete.Item> must always match the item type from the items array passed to <Autocomplete.Root>, regardless of whether itemToStringValue is used.
In other words, itemToStringValue does not change the expected type of value., it only affects how items are displayed and matched. TypeScript already enforces this constraint even when itemToStringValue is not provided, as can be seen in the Autocomplete hero demo, which does not use itemToStringValue but still passes items of the same type to value.
Because this rule is unconditional, the sentence above appears unnecessary and may imply that the constraint only applies when itemToStringValue is used. Removing it (or rephrasing it as a general clarification) would make the TypeScript inference section more accurate and less confusing.