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

[DatePicker][TimePicker] Fix lab theme augmentation #30154

Closed
wants to merge 3 commits into from

Conversation

JonKrone
Copy link
Contributor

Hi there,

While migrating a few older projects to V5, we ran into a Typescript issue where @mui/lab's themeAugmentation for some of the Picker components was misconfigured. Existing issue from someone else: #29907

The issue appears as a build error like Property 'MuiDatePicker' does not exist on type 'ComponentsOverrides'. ts(2339) or Property 'MuiPickerStaticWrapper' does not exist on type 'ComponentsVariants'. ts(2339)

There are actually two separate but similar issues:

  1. In src/themeAugmentation/components.d.ts, the MuiDatePicker and MuiDateTimePicker declared stylesOverrides: ComponentsOverrides['MuiDatePicker']. However, ComponentsOverrides does not have a key for those components because those Pickers are not style-able. From my digging, they do not expose a classes prop or have any xxxClassMap type available so I believe they actually don't have any styleOverrides available. My fix here was to remove the styleOverrides key in this type, similar to what is done with the Stack component here
  2. In src/themeAugmentation/props.d.ts, MuiPickerStaticWrapper hadn't been added to the ComponentsPropsList types, so the use of that key in the themeAugmentation/components.d.ts file was invalid. Adding it to the list seemed like what was missing.

There have been 2 PRs (#29517, #29517) over the past month that have touched/attempted to fix this exact code, so it may be worth a deeper look by maintainers.

Actual errors ```sh ../../node_modules/@mui/lab/themeAugmentation/components.d.ts:21:42 - error TS2339: Property 'MuiDatePicker' does not exist on type 'ComponentsOverrides'.

21 styleOverrides?: ComponentsOverrides['MuiDatePicker'];
~~~~~~~~~~~~~~~

../../node_modules/@mui/lab/themeAugmentation/components.d.ts:31:42 - error TS2339: Property 'MuiDateTimePicker' does not exist on type 'ComponentsOverrides'.

31 styleOverrides?: ComponentsOverrides['MuiDateTimePicker'];
~~~~~~~~~~~~~~~~~~~

../../node_modules/@mui/lab/themeAugmentation/components.d.ts:110:36 - error TS2339: Property 'MuiPickerStaticWrapper' does not exist on type 'ComponentsProps'.

110 defaultProps?: ComponentsProps['MuiPickerStaticWrapper'];


</details>

@mui-pr-bot
Copy link

mui-pr-bot commented Dec 11, 2021

Details of bundle changes

@material-ui/core: parsed: +Infinity% , gzip: +Infinity%
@material-ui/lab: parsed: +Infinity% , gzip: +Infinity%
@material-ui/styles: parsed: +Infinity% , gzip: +Infinity%
@material-ui/private-theming: parsed: +Infinity% , gzip: +Infinity%
@material-ui/system: parsed: +Infinity% , gzip: +Infinity%
@material-ui/unstyled: parsed: +Infinity% , gzip: +Infinity%
@material-ui/utils: parsed: +Infinity% , gzip: +Infinity%
@mui/material-next: parsed: +Infinity% , gzip: +Infinity%
@mui/joy: parsed: +Infinity% , gzip: +Infinity%

Generated by 🚫 dangerJS against 642548e

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 17, 2022
@siriwatknp
Copy link
Member

👋 The migration PR has been merged.

Please follow these steps to make sure that the contents are all updated. (Sorry for the inconvenience)

  1. pull latest master from upstream to your branch
  2. if your PR has changes on the *.md or demo files, you are likely to encounter conflict because all of them have been moved to the new folder.
    2.1 revert the change on those markdown files you did
    2.2 pull latest master from upstream (you should not see conflict)
    2.3 make the changes again at docs/data/material/*
  3. run yarn docs:api
    • you might see the changes in docs/pages/material/api/* if your PR touches some of the components
    • it is okay if there is no changes

If you are struggle with the steps above, feel free to tag @siriwatknp

@mnajdova
Copy link
Member

Note, the date pickers are moving inside https://github.com/mui/mui-x. Let's open a PR there once it is established. cc @flaviendelangle

@mnajdova mnajdova closed this Mar 23, 2022
@flaviendelangle
Copy link
Member

I applied an equivalent of this PR on https://github.com/mui/mui-x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: out-of-date The pull request has merge conflicts and can't be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants