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

Typography component no longer accepts the theme callback after upgrading to v6 #43480

Closed
sanketnaik99 opened this issue Aug 27, 2024 · 3 comments
Labels
component: Typography The React component.

Comments

@sanketnaik99
Copy link

sanketnaik99 commented Aug 27, 2024

Steps to reproduce

Link to live example: (required)

Steps:

  1. Pass a theme callback to the color prop in Typography as follows -
<Typography
    variant='subtitle2'
    color={ theme => theme.palette.gray.main }
>
        Hello World!
</Typography>

Current behavior

The theme callback throws an error that says - 'Parameter theme implicitly has an any type'

Expected behavior

The theme callback should be accepted like it was in the previous version of MUI and is also accepted by other components such as Box and Stack

Context

We have a fairly large application that uses Typography everywhere. We usually use the color prop to set the color for the text pass the theme callback and use it to pull the specified colors from our theme.

Your environment

npx @mui/envinfo
  System:
    OS: macOS 14.6.1
  Binaries:
    Node: 20.16.0 - ~/.nvm/versions/node/v20.16.0/bin/node
    npm: 10.8.1 - ~/.nvm/versions/node/v20.16.0/bin/npm
    pnpm: 8.15.5 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 127.0.6533.120
    Edge: Not Found
    Safari: 17.6
  npmPackages:
    @emotion/react: ^11.11.4 => 11.13.3 
    @emotion/styled: ^11.11.5 => 11.13.0 
    @mui/base:  5.0.0-beta.58 
    @mui/core-downloads-tracker:  6.0.0 
    @mui/icons-material: ^6.0.0 => 6.0.0 
    @mui/lab: ^6.0.0-beta.8 => 6.0.0-beta.8 
    @mui/material: ^6.0.0 => 6.0.0 
    @mui/material-nextjs: ^6.0.0 => 6.0.0 
    @mui/private-theming:  6.0.0 
    @mui/styled-engine:  6.0.0 
    @mui/system: ^6.0.0 => 6.0.0 
    @mui/types:  7.2.16 
    @mui/utils:  6.0.0 
    @mui/x-charts: ^7.14.0 => 7.14.0 
    @mui/x-charts-vendor:  7.14.0 
    @mui/x-data-grid-pro: ^7.14.0 => 7.14.0 
    @mui/x-date-pickers-pro: ^7.14.0 => 7.14.0 
    @mui/x-internals:  7.14.0 
    @mui/x-license:  7.14.0 
    @types/react: ^17.0.38 => 17.0.80 
    react: ^18.3.1 => 18.3.1 
    react-dom: ^18.3.1 => 18.3.1 
    typescript: ^5.3.3 => 5.5.4 

Search keywords: Typography, v6

@sanketnaik99 sanketnaik99 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 27, 2024
@sanketnaik99 sanketnaik99 changed the title Typography component lo longer accepts the theme callback after upgrading to v6 Typography component no longer accepts the theme callback after upgrading to v6 Aug 27, 2024
@github-actions github-actions bot removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 27, 2024
Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

We value your feedback @sanketnaik99! How was your experience with our support team?
If you could spare a moment, we'd love to hear your thoughts in this brief Support Satisfaction survey. Your insights help us improve!

@zannager zannager added the component: Typography The React component. label Aug 28, 2024
@zsidnam
Copy link

zsidnam commented Aug 30, 2024

@sanketnaik99 did you figure out what was going on here? Is it related to using the latest version of TypeScript? I just upgraded TypeScript and started running into this 😞

@sanketnaik99
Copy link
Author

@zsidnam Yeah I just ran the codemod for system props and it migrated all of the color props to sx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Typography The React component.
Projects
None yet
Development

No branches or pull requests

3 participants