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][TextField][FormLabel][InputLabel][FormControl] Use exact children type to allow React children type augmentation #38872

Merged
merged 9 commits into from
Jan 4, 2024

Conversation

nicegamer7
Copy link
Contributor

This PR fixes some inconsistencies with the typings of some of the MUI Material components, which led to type errors when the React children type was augmented. There may be more of these inconsistencies that I missed.

react-i18next is an example package that augments React's types, allowing objects to be passed as children. Without these changes, several react-i18next users were experiencing type-errors (i18next/react-i18next#1543 (comment)) related to the Autocomplete component.

@mui-bot
Copy link

mui-bot commented Sep 8, 2023

Netlify deploy preview

https://deploy-preview-38872--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 491c0c5

@nicegamer7
Copy link
Contributor Author

Hey, just wanted to check in on this.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 5, 2023
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 21, 2023
@ZeeshanTamboli ZeeshanTamboli added typescript component: autocomplete This is the name of the generic UI component, not the React module! labels Dec 21, 2023
@ZeeshanTamboli ZeeshanTamboli changed the title Use exact children type to allow React type augmentation [material-ui][TextField] Use exact children type to allow React type augmentation Dec 21, 2023
@ZeeshanTamboli ZeeshanTamboli added component: text field This is the name of the generic UI component, not the React module! component: FormControl The React component labels Dec 21, 2023
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Let's remove the test though. We can do this change to allow React type augmentation.

@ZeeshanTamboli ZeeshanTamboli changed the title [material-ui][TextField] Use exact children type to allow React type augmentation [material-ui][TextField][FormLabel][InputLabel][FormControl] Use exact children type to allow React type augmentation Dec 21, 2023
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 3, 2024
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 4, 2024
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicegamer7 I have applied the expected changes by removing the test. Looks good now, thanks!

@ZeeshanTamboli ZeeshanTamboli changed the title [material-ui][TextField][FormLabel][InputLabel][FormControl] Use exact children type to allow React type augmentation [material-ui][TextField][FormLabel][InputLabel][FormControl] Use exact children type to allow React children type augmentation Jan 4, 2024
@ZeeshanTamboli ZeeshanTamboli merged commit cb76f8f into mui:master Jan 4, 2024
19 checks passed
@nicegamer7
Copy link
Contributor Author

Thanks for taking care of this!

mnajdova pushed a commit to mnajdova/material-ui that referenced this pull request Jan 9, 2024
…t children type to allow React children type augmentation (mui#38872)

Co-authored-by: ZeeshanTamboli <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: autocomplete This is the name of the generic UI component, not the React module! component: FormControl The React component component: text field This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants