material-ui: [LoadingButton] LoadingButtonProps freezes typescript compilation on "Checking validity for types"

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

The LoadingButtonProps freezes typescript compilation. The build remains stuck on “Checking validity of types”. Using the ButtonProps interface temporarily solves the issue.

The issue is described in detail here

Expected behavior 🤔

Typescript should compile fine to javascript files.

Steps to reproduce 🕹

Steps:

  1. create a next js project with typescript and install mui
  2. create a LoadingButton component and the props for it should extend the LoadingButtonProps.
  3. render the component and run next build
  4. the terminal should be stuck on “Checking validity of types…”

Context 🔦

Was unable to use LoadingButton props which caused a build failure. I had to use ButtonProps instead which produced the build

Your environment 🌎

`npx @mui/envinfo`
    System:
    OS: Linux 5.10 Manjaro Linux
  Binaries:
    Node: 16.11.0 - /usr/bin/node
    Yarn: 1.22.10 - /usr/bin/yarn
    npm: 8.0.0 - /usr/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: 94.0.1

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 11
  • Comments: 22 (2 by maintainers)

Most upvoted comments

What information is missing here? The bug is clear, and has been corroborated by multiple people.

Since the issue is missing key information, and has been inactive for 7 days, it has been automatically closed. If you wish to see the issue reopened, please provide the missing information.

@mbrookes Why was this closed? The above suggestion is only a workaround. It should be possible to use LoadingButtonProps without tsc hanging.

just got bit by this, too.

trying to do this:

import type {LoadingButtonProps} from '@mui/lab';
// ...use it in a component...

causes tsc --noEmit --project ./my/project to hang indefinitely.

replacing the type import with a custom one using ButtonProps:

interface LoadingButtonProps extends ButtonProps {
    loading: boolean;
    loadingPosition: 'start' | 'end' | 'center';
}
// ...use it in a component...

allows tsc to finish successfully.

@mui/lab@5.0.0-alpha.59
@mui/material@5.2.3
tsc version 4.4.3 (also happens with 4.6.0)

tsc appears to spend a lot of time in: inferFromIndexTypes() and getUnionType(): node tsc flamegraph

just got bit by this, too.

trying to do this:

import type {LoadingButtonProps} from '@mui/lab';
// ...use it in a component...

causes tsc --noEmit --project ./my/project to hang indefinitely.

replacing the type import with a custom one using ButtonProps:

interface LoadingButtonProps extends ButtonProps {
    loading: boolean;
    loadingPosition: 'start' | 'end' | 'center';
}
// ...use it in a component...

allows tsc to finish successfully.

@mui/lab@5.0.0-alpha.59
@mui/material@5.2.3
tsc version 4.4.3 (also happens with 4.6.0)

tsc appears to spend a lot of time in: inferFromIndexTypes() and getUnionType(): node tsc flamegraph

Yes, this is what I ended up doing as well.

I’ve been struggling with this issue too. tsc check types end up in heap out of memory. VSCode Intellisense also gets stuck on loading.

image

  • Typescript version: v4.9.4
  • "yarn@3.3.1" - node_modules (not zero-installs)
  • Node v16 latest LTS
  • MUI packages:
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"@mui/icons-material": "^5.0.1",
"@mui/lab": "^5.0.0-alpha.88",
"@mui/material": "^5.0.2",
"@mui/styles": "^5.9.3",

facing the same problem when start to using yarn 2 pnp