Skip to content

[icons] v7 "@mui/icons-material" typing is not working correctly for named exports #45697

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

Closed
laurence-hudson-mindfoundry opened this issue Mar 26, 2025 · 7 comments · Fixed by #45704
Assignees
Labels
package: icons Specific to @mui/icons regression 🐛 A bug, but worse typescript

Comments

@laurence-hudson-mindfoundry
Copy link

laurence-hudson-mindfoundry commented Mar 26, 2025

Steps to reproduce

Minimal reproduction: https://stackblitz.com/edit/mui7-ts-icons?file=package.json

Current behavior

In v7 the wrong type information appears to be exposed for the index import path of "@mui/icons-material". The type information is that of a single icon (icon.d.ts) instead of named exports for all icons (index.d.ts). This issue is limited to the typing (the icons are actually importable as named exports).

import { AccessAlarm } from '@mui/icons-material';
results in
error TS2614: Module '"@mui/icons-material"' has no exported member 'AccessAlarm'

Expected behavior

Option 2 from the icon usage doc at https://mui.com/material-ui/icons/#usage should provide correct typing.

Context

I have offered some thoughts on a fix in MR #45695.

Your environment

npx @mui/envinfo

System:
OS: Linux 5.0 undefined
Binaries:
Node: 18.20.3 - /usr/local/bin/node
npm: 10.2.3 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
Browsers: n/a
npmPackages:
@emotion/react: 11.14.0
@emotion/styled: 11.14.0 => 11.14.0
@mui/core-downloads-tracker: 7.0.0
@mui/icons-material: 7.0.0 => 7.0.0
@mui/material: 7.0.0
@mui/private-theming: 7.0.0
@mui/styled-engine: 7.0.0
@mui/system: 7.0.0
@mui/types: 7.4.0
@mui/utils: 7.0.0
@types/react: 19.0.12
react: 19.0.0
react-dom: 19.0.0
typescript: 5.8.2 => 5.8.2

Search keywords: icon, types

@apeiniger
Copy link

Have the same issue after the v7 upgrade

@wichayapoka
Copy link

Same issue. Regression seems started on 7.0.0-beta.3 and it affects a stable release. 7.0.0-beta.2 works fine

@aarongarciah aarongarciah assigned Janpot and unassigned aarongarciah Mar 27, 2025
@aarongarciah aarongarciah added the package: icons Specific to @mui/icons label Mar 27, 2025
@Janpot Janpot added regression 🐛 A bug, but worse and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 27, 2025
@Janpot
Copy link
Member

Janpot commented Mar 27, 2025

Thank you for reporting!
Fixed in #45704
Confirmed by https://stackblitz.com/edit/mui7-ts-icons-uxtzndup?file=package.json

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.

@laurence-hudson-mindfoundry
Copy link
Author

@Janpot Thanks for sorting this so promptly. Could you clarify what the timeline for release with this fix in it might be?

@Janpot
Copy link
Member

Janpot commented Mar 27, 2025

Could you clarify what the timeline for release with this fix in it might be?

We'll likely release a patch release before the weekend.

@wichayapoka
Copy link

I updated to 7.0.1 and now the types are correct. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: icons Specific to @mui/icons regression 🐛 A bug, but worse typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants