material-ui: Small TypeScript error after upgrading from 5.0.4 to 5.0.5
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior π―
After upgrading to the latest 5.0.5 version the following TypeScript code reports an error src/pages/AboutPage/index.tsx:9:30 - error TS7031: Binding element 'theme' implicitly has an 'any' type.
import React from 'react';
import {Stack, Paper, Typography, Box} from '@mui/material';
import {styled} from '@mui/material/styles';
import useDocumentTitle from '../../hooks/useDocumentTitle';
import getSysInfo from './sysinfo';
const pageTitle = 'About';
const Item = styled(Paper)(({theme}) => ({
...theme.typography.body2,
padding: theme.spacing(1),
textAlign: 'left',
color: theme.palette.text.secondary,
}));
Expected Behavior π€
No error as before
Steps to Reproduce πΉ
Context π¦
Your Environment π
`npx @mui/envinfo`
System:
OS: macOS 12.0.1
CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
Memory: 92.19 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.12.0 - ~/.nvm/versions/node/v16.12.0/bin/node
npm: 8.1.1 - ~/.nvm/versions/node/v16.12.0/bin/npm
Watchman: 2021.10.11.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.1 - /usr/local/bin/pod
Homebrew: 3.2.16 - /usr/local/bin/brew
pip3: 21.2.4 - /usr/local/bin/pip3
RubyGems: 3.0.3.1 - /usr/bin/gem
Utilities:
CMake: 3.21.3 - /usr/local/bin/cmake
Make: 3.81 - /usr/bin/make
GCC: 4.2.1 - /usr/bin/gcc
Git: 2.30.1 - /usr/bin/git
Clang: 13.0.0 - /usr/bin/clang
Subversion: 1.14.1 - /usr/local/bin/svn
Servers:
Apache: 2.4.48 - /usr/sbin/apachectl
Virtualization:
Docker: 20.10.8 - /usr/local/bin/docker
SDKs:
iOS SDK:
Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0
IDEs:
Nano: 2.0.6 - /usr/bin/nano
VSCode: 1.61.2 - /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code
Vim: 8.2 - /usr/bin/vim
Xcode: 13.0/13A233 - /usr/bin/xcodebuild
Languages:
Bash: 3.2.57 - /bin/bash
Java: 11.0.10 - /usr/bin/javac
Perl: 5.34.0 - /usr/local/bin/perl
Python: 3.9.7 - /usr/local/bin/python
Python3: 3.9.7 - /usr/local/bin/python3
Ruby: 2.6.8 - /usr/bin/ruby
Databases:
SQLite: 3.36.0 - /usr/bin/sqlite3
Browsers:
Chrome: 95.0.4638.54
Safari: 15.1
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 15 (3 by maintainers)
Itβs actually very hard to go backwards. When I force version 5.0.4 I still get the error. It turns out that
@mui/material v5.0.4will happily fetch version@mui/system@5.0.5, and this causes the error.Simply Installing @mui/system@=5.04 using yarn does NOT fix it, and
yarn whygives the reason:So I end up with two version of @mui/system.
And it turns out that
@mui/systemis the culprit. I can actually keep @mui/material@5.0.5 (latest), but I have to force @mui/system@5.0.4 using yarnβs resolutions:And now I can build again π
I think the issue could be in packages/mui-system/src/createStyled.d.ts.
I installed version 5.0.5 and replace the file content with the one in 5.0.4 and it works perfectly.
Also having this issue after upgrading to 5.0.5 on a nextjs project In my case,
styledformimport { styled } from '@mui/system'is resolving to any type