[material-ui][Autocomplete] Fix renderOption props type#42689
[material-ui][Autocomplete] Fix renderOption props type#42689DiegoAndai merged 5 commits intomui:nextfrom
Conversation
Netlify deploy previewhttps://deploy-preview-42689--material-ui.netlify.app/ Bundle size report |
|
@aarongarciah I've added the "React 19 support" label so we can add it to all PRs related to React 19, in case we need to backport it from v6 (next) to v5 (master). I also added the needs cherry-picking label as this is an issue currently affecting users: #39833 (comment) |
|
Also, I didn't find any other similar type bugs in other components 👍🏼 |
| } | ||
|
|
||
| export type UseAutocompleteGetOptionPropsReturnValue = React.HTMLAttributes<HTMLLIElement> & { | ||
| key: any; |
There was a problem hiding this comment.
Should we use the type coming from @types/react?
| key: any; | |
| key: React.Key; |
There was a problem hiding this comment.
Ideally, yes, but I would keep any as that's the type declared in Base's getOptionProps and we don't want to update that.
aarongarciah
left a comment
There was a problem hiding this comment.
Looks good! Left a couple of inline comments for your consideration.
Closes #39833
Fixes second bug described in #39833 (comment). The first bug was fixed in #42099.
Use the correct type for
renderOptions'spropscallback argument. The type comes from UseAutocompleteReturnValue.Before: https://codesandbox.io/p/sandbox/39833-render-option-type-next-vd4jpp?file=%2Fsrc%2FDemo.tsx
After: https://codesandbox.io/p/devbox/f27pj7?file=%2Fsrc%2FDemo.tsx%3A7%2C18