Skip to content

TypeScript errors upgrading MUI from 4.9.5 to 4.9.9 #20441

@NMinhNguyen

Description

@NMinhNguyen
  • 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:

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:

  1. Install @material-ui/[email protected]
  2. Run your project through tsc using [email protected]
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions