Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Autocomplete] Typization mistake in AutocompleteRenderGroupParams #44818

Open
khrulenko opened this issue Dec 20, 2024 · 3 comments · May be fixed by #44862
Open

[Autocomplete] Typization mistake in AutocompleteRenderGroupParams #44818

khrulenko opened this issue Dec 20, 2024 · 3 comments · May be fixed by #44862
Assignees
Labels
bug 🐛 Something doesn't work typescript

Comments

@khrulenko
Copy link

khrulenko commented Dec 20, 2024

Steps to reproduce

Steps:

  1. Reach params in renderGroup in Autocomplete
  2. Check the actual type of key (it's number)
  3. Compare the type of key with the type in AutocompleteRenderGroupParams (it's string)

Current behavior

export interface AutocompleteRenderGroupParams {
key: string;
group: string;
children?: React.ReactNode;
}

Expected behavior

export interface AutocompleteRenderGroupParams {
key: number; ←←←
group: string;
children?: React.ReactNode;
}

Context

No response

Your environment

No response

Search keywords: Autocomplete AutocompleteRenderGroupParams

Search keywords:

@khrulenko khrulenko added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Dec 20, 2024
@michelengelen michelengelen transferred this issue from mui/mui-x Dec 20, 2024
@siddhantantil39
Copy link
Contributor

Upon checking renderGroup in Autocomplete component, the key prop is of type string, also has an implicit conversion to string to be safe.

@khrulenko
Copy link
Author

khrulenko commented Dec 23, 2024

Upon checking renderGroup in Autocomplete component, the key prop is of type string, also has an implicit conversion to string to be safe.

Actual type of params.key is number despite of Typescript shows that the type is string.
params.key should be a string. Or type should be changed to number.

photo_2024-12-23_21-21-56

@aarongarciah
Copy link
Member

Hi @khrulenko, thanks for reporting. I've opened this PR to make runtime and TS types to be in sync: #44862

@aarongarciah aarongarciah removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 26, 2024
@aarongarciah aarongarciah self-assigned this Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work typescript
Projects
None yet
3 participants