Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type error importing @mui/styled-engine from @mui/material using skipLibCheck: false #44079

Open
1 task done
Methuselah96 opened this issue Oct 12, 2024 · 2 comments
Open
1 task done
Assignees
Labels
package: material-ui Specific to @mui/material package: system Specific to @mui/system status: waiting for maintainer These issues haven't been looked at yet by a maintainer typescript

Comments

@Methuselah96
Copy link
Contributor

Methuselah96 commented Oct 12, 2024

Search keywords

type error missing dependency

Latest version

  • I have tested the latest version

Steps to reproduce

Steps:

  1. Start a TypeScript project with @mui/material using a strict package manager (e.g., pnpm or Yarn PnP) and with skipLibCheck set to false

Current behavior

Type error:

./node_modules/@mui/material/utils/memoTheme.d.ts(4,14): error TS2307: Cannot find module '@mui/styled-engine' or its corresponding type declarations.
./node_modules/@mui/material/utils/memoTheme.d.ts(6,42): error TS2307: Cannot find module '@mui/styled-engine' or its corresponding type declarations.
./node_modules/@mui/material/utils/memoTheme.d.ts(6,91): error TS2307: Cannot find module '@mui/styled-engine' or its corresponding type declarations.
./node_modules/@mui/material/utils/memoTheme.d.ts(6,132): error TS2307: Cannot find module '@mui/styled-engine' or its corresponding type declarations.
./node_modules/@mui/material/utils/memoTheme.d.ts(6,180): error TS2307: Cannot find module '@mui/styled-engine' or its corresponding type declarations.
./node_modules/@mui/material/utils/memoTheme.d.ts(6,221): error TS2307: Cannot find module '@mui/styled-engine' or its corresponding type declarations.

This is caused by the fact that @mui/material references @mui/styled-engine, but does not have a dependency on it.

Expected behavior

No type error

Context

N/A

Your environment

npx @mui/envinfo
"@mui/material": "^6.1.3"
@Methuselah96 Methuselah96 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 12, 2024
@siriwatknp
Copy link
Member

siriwatknp commented Oct 14, 2024

Strange, Material UI import memoTheme from @mui/system (which is a direct dependency), not @mui/styled-engine, even though the @mui/system reexports it from @mui/styled-engine.

https://github.com/mui/material-ui/blob/master/packages/mui-material/src/utils/memoTheme.ts#L1

@siriwatknp
Copy link
Member

Ah, it's the memoTheme.d.ts after the build:

import { Theme } from '../styles/createTheme';
declare const memoTheme: (styleFn: (props: {
    theme: Theme;
}) => import("@mui/styled-engine").CSSInterpolation) => (props: {
    theme: Theme;
}) => string | number | boolean | import("@mui/styled-engine").ComponentSelector | import("@mui/styled-engine").Keyframes | import("@mui/styled-engine").SerializedStyles | import("@mui/styled-engine").CSSObject | import("@mui/styled-engine").ArrayCSSInterpolation | null;
export default memoTheme;

@siriwatknp siriwatknp added typescript package: system Specific to @mui/system package: material-ui Specific to @mui/material labels Oct 14, 2024
@DiegoAndai DiegoAndai moved this to Backlog in Material UI Oct 14, 2024
@ZeeshanTamboli ZeeshanTamboli changed the title Type error importing @mui/styled-engine from @mui/material Type error importing @mui/styled-engine from @mui/material using skipLibCheck: false Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: material-ui Specific to @mui/material package: system Specific to @mui/system status: waiting for maintainer These issues haven't been looked at yet by a maintainer typescript
Projects
Status: Backlog
Development

No branches or pull requests

2 participants