TypeScript errors upgrading MUI from 4.9.5 to 4.9.9
See original GitHub issue- 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 😯
I have been able to trace the following errors to some changes made recently to use TS features such as Omit
which aren’t available in 3.2.4 (as far as I understand, that’s the minimum TS version that MUI supports) or trailing commas:
- https://github.com/mui-org/material-ui/pull/20264 (
Omit
) - https://github.com/mui-org/material-ui/pull/20211 (the trailing comma issue)
Click to expand
node_modules/@material-ui/core/Backdrop/Backdrop.d.ts:8:52 - error TS2304: Cannot find name 'Omit'.
8 React.HTMLAttributes<HTMLDivElement> & Partial<Omit<FadeProps, 'children'>>,
~~~~
node_modules/@material-ui/core/Box/Box.d.ts:29:22 - error TS1009: Trailing comma not allowed.
29 typeof typography,
~
node_modules/@material-ui/core/Fade/Fade.d.ts:4:36 - error TS2304: Cannot find name 'Omit'.
4 export interface FadeProps extends Omit<TransitionProps, 'children'> {
~~~~
node_modules/@material-ui/core/TextareaAutosize/TextareaAutosize.d.ts:4:11 - error TS2304: Cannot find name 'Omit'.
4 extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'children' | 'rows'> {
~~~~
node_modules/@material-ui/core/styles/shadows.d.ts:26:9 - error TS1009: Trailing comma not allowed.
26 string,
~
Expected Behavior 🤔
Steps to Reproduce 🕹
Steps:
- Install
@material-ui/core@4.9.9
- Run your project through
tsc
usingtypescript@3.2.4
- Observe the errors above
Context 🔦
We set a minimum supported version of TypeScript to 3.2.4 in our design system to match Material-UI but seems like the latest MUI version uses newer TypeScript features. This isn’t usually a big issue to React projects, but we also support Angular teams via Custom Elements and usually bumping TypeScript requires them to bump their Angular versions too (usually across major version boundaries) which can be a bit painful. For example, Angular 7.2 supports TS 3.2.4, Angular 8.0.0 adds support for 3.4 dropping support for older versions, Angular 9.0.0 requires 3.6/3.7
Your Environment 🌎
Tech | Version |
---|---|
Material-UI | v4.9.9 |
TypeScript | v3.2.4 |
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (13 by maintainers)
Top GitHub Comments
Yeah this is what we wanted to avoid but I’d argue that this is more of an issue with a PR that was too big not the tooling.
I would rather move forward here though (upcoming
@ts-expect-error
and tslint -> eslint). Usage numbers for earlier typescript version is pretty low so I don’t think it’s justified to build tooling for 3.2. But this is for me personally. If wants to build it I’m all ears.@eps1lon I wanted to ask about this a couple of days ago, this is an opportunity. What do you think about this diff?