mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
94.05k stars 32.32k forks source link

[@mui/joy] `components` is not in `Theme` type #42245

Open Onurfesci opened 6 months ago

Onurfesci commented 6 months ago

Steps to reproduce

Link to live example: (required) https://codesandbox.io/p/sandbox/morning-brook-wjkmj4?file=%2Fsrc%2FDemo.tsx

Steps:

  1. Try to use components from useTheme result
  2. TS Error

Current behavior

There is a TS error when trying to access theme.components even though it is definitely there.

image

Expected behavior

I think components should be part of the Theme type by default, even if it's an optional type - I have to override Theme type for it to work as expected

Context

No response

Your environment

npx @mui/envinfo ``` System: OS: macOS 14.4.1 Binaries: Node: 21.6.0 - /usr/local/bin/node npm: 10.2.4 - /usr/local/bin/npm pnpm: 9.0.6 - /usr/local/bin/pnpm Browsers: Chrome: 124.0.6367.207 Edge: 124.0.2478.105 Safari: 17.4.1 npmPackages: @mui/base: 5.0.0-beta.40 => 5.0.0-beta.40 @mui/private-theming: 5.15.14 @mui/styled-engine: 5.15.14 @mui/system: ^5.15.15 => 5.15.15 @mui/utils: 5.15.14 ```

Search keywords: mui, joy, theme, components, type

siriwatknp commented 3 months ago

Thanks for reporting the issue! Joy UI development is temporarily on hold as the maintainers focus on the next two major releases of Material UI