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

[material-ui][Select] Typescript errors with generic argument for multiple select #41375

Closed
Sengulair opened this issue Mar 5, 2024 · 2 comments · Fixed by #41405
Closed
Assignees
Labels
component: select This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material ready to take Help wanted. Guidance available. There is a high chance the change will be accepted regression A bug, but worse typescript

Comments

@Sengulair
Copy link

Sengulair commented Mar 5, 2024

Steps to reproduce

Typescript reproduction example: Link
Using the generic argument in the Select component with multiple property causes an error by passing the generic argument to value and to onChange properties

Current behavior

Typescript error when using generic component and passing value with generic type to value and onChange function.

Expected behavior

No Typescript errors

Context

I tested the 5.15.10 version. It was good, without error. Looking at the source code of the newer version I see that passing Variant as a second type argument to the SelectProps type causes that error. Maybe it's a Typescript issue here, but I can't understand why.

Your environment

npx @mui/envinfo
  System:
    OS: Windows 11 10.0.22631
  Binaries:
    Node: 20.10.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.2.3 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.10.2 - ~\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Chrome: Not Found
    Edge: Chromium (122.0.2365.66)
  npmPackages:
    @emotion/react:  11.11.3 
    @emotion/styled: ^11.11.0 => 11.11.0 
    @mui/base:  5.0.0-beta.38 
    @mui/core-downloads-tracker:  5.15.12 
    @mui/material: ^5.15.12 => 5.15.12 
    @mui/private-theming:  5.15.12 
    @mui/styled-engine:  5.15.11 
    @mui/system:  5.15.12 
    @mui/types:  7.2.13 
    @mui/utils:  5.15.12 
    @types/react: ^18.2.58 => 18.2.58 
    react: ^18.2.0 => 18.2.0
    react-dom: ^18.2.0 => 18.2.0
    typescript: ^5.3.3 => 5.3.3

5.15.10 -> 5.15.12

Search keywords: Select, generic, types, typescript

@Sengulair Sengulair added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Mar 5, 2024
@Sengulair Sengulair changed the title [material-ui][Select] value and onChange typescript errors from [material-ui][Select] Typescript errors with generic argument for multiple select Mar 5, 2024
@danilo-leal danilo-leal added component: select This is the name of the generic UI component, not the React module! typescript package: material-ui Specific to @mui/material labels Mar 5, 2024
@DiegoAndai DiegoAndai self-assigned this Mar 5, 2024
@DiegoAndai DiegoAndai added regression A bug, but worse and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 5, 2024
@DiegoAndai
Copy link
Member

Hey @Sengulair, thanks for the report!

This is related to #39137 (comment) and #41356. I'll keep it open as it's a new case where the updated type breaks, so we should make sure that we fix it.

@DiegoAndai DiegoAndai added the ready to take Help wanted. Guidance available. There is a high chance the change will be accepted label Mar 7, 2024
@DiegoAndai
Copy link
Member

Adding the ready to take label in case we get any contributors with an idea of how to solve this. Let's discuss potential solutions here if you wish to work on this.

sai6855 added a commit to sai6855/material-ui that referenced this issue Mar 12, 2024
sai6855 added a commit to sai6855/material-ui that referenced this issue Mar 12, 2024
sai6855 added a commit to sai6855/material-ui that referenced this issue Mar 12, 2024
sai6855 added a commit to sai6855/material-ui that referenced this issue Mar 12, 2024
sai6855 added a commit to sai6855/material-ui that referenced this issue Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: select This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material ready to take Help wanted. Guidance available. There is a high chance the change will be accepted regression A bug, but worse typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants