material-react-table icon indicating copy to clipboard operation
material-react-table copied to clipboard

Generic types referencing @mui/x-date-pickers wrong after v2.13.0

Open lpicchi opened this issue 1 year ago • 1 comments

material-react-table version

v2.13.0

react & react-dom versions

v18.3.1

Describe the bug and the steps to reproduce it

When using version > v2.13.0 some types definitions referencing @mui/x-date-pickers are wrongly using generics

Example:

  • Before v2.13.0 (Correct use of generics):

image

  • After v2.13.0 (Incorrect use of generics):

image image

Looking at src/types.ts for v2 it looks fine. But the types generated in dist when building seems to be different and wrong

For v2.13.0 there are six places where types are wrong

image

But for v2.13.1 only 3 places

image

So it seems part of the issue has been solved between v2.13.0 and v2.13.1 somehow

I'm not able to use tools like dts-bundle-generator because of this problem and had to downgrade to 2.12.1

Minimal, Reproducible Example - (Optional, but Recommended)

Optional

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

Maybe, I'll investigate and start debugging

Terms

  • [X] I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

lpicchi avatar Dec 03 '24 19:12 lpicchi

I've recently found this error when updating my version of @mui/x-date-pickers to v8.5.2 - there was a breaking change in v8 to the ...PickerProps<never> types that removed passing the date object as a generic.

Initially I tried an override but these don't work on package peer-dependencies:

    "overrides": {
        "material-react-table": {
            "@mui/x-date-pickers": "^7.29.2"
        }
    }

My current (hopefully temporary) solution has been to add a local patch that changes the types ...PickerProps<never> to ...PickerProps in /node_modules/material-react-table/dist/index.d.ts but a proper fix would be to address this in the source declaration file (perhaps conditionally giving the generic if needed?).

TLDR: The @mui/x-date-pickers peer-dependency version is not restricted to the major version that it needs: e.g. >= 7.15 (should be ^7.15)

idesigncode avatar Jun 20 '25 00:06 idesigncode