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][Box] Add missing component to BoxProps type #44643

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

DiegoAndai
Copy link
Member

@DiegoAndai DiegoAndai commented Dec 3, 2024

Closes #43955

This was an oversight of #43384, as the System BoxProps had the component property, but Material UI's didn't. They should be equivalent. I added a test for it as well.

@mui-bot
Copy link

mui-bot commented Dec 3, 2024

Netlify deploy preview

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

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 947ab93

@@ -39,3 +39,5 @@ function ColorTest() {
sx={(theme) => ({ backgroundColor: theme.vars.palette.background.default })}
/>;
}

expectType<SystemBoxProps['component'], MaterialBoxProps['component']>;
Copy link
Contributor

Choose a reason for hiding this comment

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

expectType is function know? for e.g, this passes expectType<null,undefined> but this doesn't expectType<null,undefined>()

Copy link
Member Author

Choose a reason for hiding this comment

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

In this case I'm using it to check types, so there's no value to be provided.

Copy link
Contributor

Choose a reason for hiding this comment

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

From my understanding of expectType, it only works if it is called. So for e.g, typescript doesn't throw error for following code, when ideally it should

expectType<null,undefined>

image

Copy link
Member Author

Choose a reason for hiding this comment

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

You're correct @sai6855, my bad. Opened a PR to fix it: #44651.

@DiegoAndai DiegoAndai merged commit 617a4e0 into mui:master Dec 4, 2024
19 checks passed
@DiegoAndai DiegoAndai deleted the fix-box-types branch December 4, 2024 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Box The React component. package: material-ui Specific to @mui/material typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MUI v6] Box component warns about TypeScript type
4 participants