Skip to content

Conversation

@tomasnikl
Copy link

@tomasnikl tomasnikl commented Sep 4, 2024

Fixes: #43607

Signed-off-by: Tomas Nikl <tomasnikl.cz@gmail.com>
@tomasnikl tomasnikl changed the title fix Theme interface [theme] fix Theme interface Sep 4, 2024
@ZeeshanTamboli ZeeshanTamboli changed the title [theme] fix Theme interface [material-ui][theme] Fix wrong cssVariables type in Theme interface Sep 4, 2024
@ZeeshanTamboli ZeeshanTamboli added type: bug It doesn't behave as expected. typescript package: material-ui customization: theme Higher level theming customizability. labels Sep 4, 2024
@ZeeshanTamboli ZeeshanTamboli changed the title [material-ui][theme] Fix wrong cssVariables type in Theme interface [material-ui][theme] Fix wrong cssVariables TypeScript type in Theme interface Sep 4, 2024
@mui-bot
Copy link

mui-bot commented Sep 4, 2024

Netlify deploy preview

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

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 4486a36

@ZeeshanTamboli ZeeshanTamboli changed the title [material-ui][theme] Fix wrong cssVariables TypeScript type in Theme interface [material-ui][theme] Fix wrong cssVariables TypeScript type in Theme Sep 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.

Before anything else, I'm not sure if the literal type was intentionally added in #43115 or if it was a mistake. cssVariables is false when there's a theme without CSS variables. However, it seems like a bug based on the CodeSandbox you shared in the issue.

If we switch to using boolean, the cssVariables isn't just boolean; it can have other types too, as shown here and in the docs.

I'll let @siriwatknp review this PR.

@siriwatknp
Copy link
Member

siriwatknp commented Sep 13, 2024

It's intentional, the cssVariables will always be false or an object (with config).

Note that the input can be true but at the end it will be set as an object.

@siriwatknp siriwatknp closed this Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

customization: theme Higher level theming customizability. type: bug It doesn't behave as expected. typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[material-ui][theme] Wrong cssVariables type in Theme interface

4 participants