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

[typescript] SystemCSSProperties should not have SystemStyleObject as value #44029

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Oct 7, 2024

It does not make sense for CSS Properties to have value as SystemStyleObject like this:

{
  color: {
    '&.selector': {}
  }
}

This might be a slightly typescript per improvement and it won't have any affect on the consumer side because the sx prop currently support nesting object with any keys (due to CSS selector)


@siriwatknp siriwatknp added typescript package: system Specific to @mui/system enhancement This is not a bug, nor a new feature labels Oct 7, 2024
@siriwatknp siriwatknp requested review from Janpot and a team October 7, 2024 04:19
@siriwatknp siriwatknp changed the title [typescript] Replace SystemStyleObject with null [typescript] SystemCSSProperties should not have SystemStyleObject as value Oct 7, 2024
@mui-bot
Copy link

mui-bot commented Oct 7, 2024

Netlify deploy preview

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

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 19a638d

Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

Nice catch!

@siriwatknp siriwatknp merged commit fee6fdd into mui:master Oct 7, 2024
21 of 22 checks passed
@rathpc
Copy link

rathpc commented Oct 22, 2024

I have discovered that this change actually broke types in the sx props in some cases.

For example, try to use theme.typography.fontWeightBold on the fontWeight prop on a Link component. The sx prop will yell at you because fontWeightBold could potentially be undefined. I do not believe this change is correct.

I would be happy to open a PR to revert this, please let me know.

@rathpc
Copy link

rathpc commented Oct 23, 2024

I have discovered that this change actually broke types in the sx props in some cases.

For example, try to use theme.typography.fontWeightBold on the fontWeight prop on a Link component. The sx prop will yell at you because fontWeightBold could potentially be undefined. I do not believe this change is correct.

I would be happy to open a PR to revert this, please let me know.

I discovered this was actually an issue of types in our custom theme and was able to resolve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is not a bug, nor a new feature package: system Specific to @mui/system typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants