Could not find a declaration file for module '@mui/icons-material/Visibility'.
See original GitHub issueDuplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
I installed the latest version of material-ui and mui/icons-material v5.5.0. When I import an icon:
import Visibility from '@mui/icons-material/Visibility';
I got this error:
Could not find a declaration file for module '@mui/icons-material/Visibility'. 'C:/Users/User/project/app-react/frontend/node_modules/@mui/icons-material/Visibility.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/mui__icons-material` if it exists or add a new declaration (.d.ts) file containing `declare module '@mui/icons-material/Visibility';
Expected behavior 🤔
Should fix the eslint error while installing @mui/icons-material.
Steps to reproduce 🕹
Steps:
- Install the latest material-ui
- Install the latest mui/icons-material
Context 🔦
No response
Your environment 🌎
`npx @mui/envinfo`
System:
OS: Windows 10 10.0.19042
Binaries:
Node: 16.14.0 - C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: Not Found
Edge: Spartan (44.19041.1266.0), Chromium (99.0.1150.36)
npmPackages:
@mui/base: 5.0.0-alpha.71
@mui/icons-material: ^5.5.0 => 5.5.0
@mui/material: ^5.5.0 => 5.5.0
@mui/private-theming: 5.4.4
@mui/styled-engine: 5.4.4
@mui/styled-engine-sc: ^5.4.2 => 5.4.2
@mui/system: 5.5.0
@mui/types: 7.1.2
@mui/utils: 5.4.4
@types/react: ^17.0.40 => 17.0.40
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
styled-components: ^5.3.3 => 5.3.3
typescript: ^4.6.2 => 4.6.2
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Could not find a declaration file for module 'material-ui/styles ...
Try npm install @types/material-ui/styles/MuiThemeProvider if it exists or add a new declaration (.d.ts) file containing declare module ...
Read more >Could not find declaration file for module 'react' | bobbyhadz
The error "could not find declaration file for module 'react'" occurs when TypeScript cannot find the type declaration for a react-related module.
Read more >@mui/icons-material - npm
This package provides the Google Material Icons converted to SvgIcon components. Installation. Install the package in your project directory ...
Read more >Minimizing bundle size - Material UI - MUI
While importing directly in this manner doesn't use the exports in the main file of @mui/material , this file can serve as a...
Read more >module not found: error: can't resolve '@mui/icons-material' in ...
Oct 25, 2021 ... FileDownload icon is added in v5, it does not exist in v4. You can search for v4 icons here....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What I did to fix this was to
Option 1, seeme to be the issue in TypeScript, import your desired icon using Option 2, this takes away the error.
Also, If need be, you can choose a diffr=erent name for your imports, such as
now you can use the AccessAlarm icon like so <MUIAccessAlarmICON/>
Tags should include TypeScript