material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

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

Open Onurfesci opened this issue 9 months ago • 0 comments

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

Onurfesci avatar May 15 '24 11:05 Onurfesci