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

Typescript: material-ui-pickers/typings/overrides does not exist #1794

Closed
MuratGT opened this issue May 19, 2020 · 12 comments
Closed

Typescript: material-ui-pickers/typings/overrides does not exist #1794

MuratGT opened this issue May 19, 2020 · 12 comments
Labels
bug 🐛 Something isn't working typescript

Comments

@MuratGT
Copy link

MuratGT commented May 19, 2020

import { Overrides } from "@material-ui/core/styles/overrides";
import { MuiPickersOverrides } from '@material-ui-pickers/typings/overrides' // Cannot find module '@material-ui-pickers/typings/overrides'.ts(2307)

type overridesNameToClassKey = { [P in keyof MuiPickersOverrides]: keyof 
MuiPickersOverrides[P] }

declare module "@material-ui/core/styles/overrides" {
    export interface ComponentNameToClassKey extends overridesNameToClassKey { }
}

How do I extend the overrides with the material-picker overrides? This does not work since MuiPickersDateRangePickerInput cannot be found in the core overrides.

const materialTheme = createMuiTheme({
    overrides: {
        MuiPickersDateRangePickerInput: {
            rangeInputsContainer: {
                maxWidth: 400
            }
        }
    }
});

I can fix it by asserting it as any, but this I don't want to.

Version:

"@material-ui/pickers": "4.0.0-alpha.5"

@oliviertassinari
Copy link
Member

Linking to mui/material-ui#19427 as very much related.

@dmtrKovalenko
Copy link
Member

I suppose its because you are trying to import material-ui-pickers but the package is @material-ui/pickers

@MuratGT
Copy link
Author

MuratGT commented May 19, 2020

Oh sorry, that was a typo. I changed it to @material-ui. Same result

@oliviertassinari
Copy link
Member

@dmtrKovalenko Did #1796 solve this issue?

@dmtrKovalenko
Copy link
Member

I think no, /typings/overrides.ts file didn't change.
Have no idea what the problem have @MuratGT and there is still no reproduction 🤷‍♂️

@oliviertassinari oliviertassinari added the status: incomplete Need more information label Jun 2, 2020
@oliviertassinari
Copy link
Member

@MuratGT Please provide a full reproduction test case. This would help a lot 👷 .
A live example would be perfect. This codesandbox.io template may be a good starting point. Thank you!

@MuratGT
Copy link
Author

MuratGT commented Jun 2, 2020

@dmtrKovalenko
Copy link
Member

dmtrKovalenko commented Jun 2, 2020

It doesn't throw an error if downgrade to mui core 4.10.0 (#1849):
https://codesandbox.io/s/zealous-brook-5urzm?file=/src/timerange.test.tsx

There is an issue with missing typings, but it will be fixed in the next release

@MuratGT
Copy link
Author

MuratGT commented Jun 2, 2020

You don't get this error?

Object literal may only specify known properties, and 'MuiPickersDateRangePickerInput' does not exist in type 'Overrides'.ts(2322)

@dmtrKovalenko
Copy link
Member

Yes, but it is not the same as "Typescript: material-ui-pickers/typings/overrides does not exist" in issue title. If so it is fixed by #1796

@oliviertassinari
Copy link
Member

I have updated the dependencies of the reproduction of @MuratGT: https://codesandbox.io/s/sparkling-wildflower-6e8wx?file=/src/timerange.test.tsx. This gives us the reported error:

'MuiPickersDateRangePickerInput' does not exist in type 'Overrides'

Now, if we apply the guidelines in https://next.material-ui-pickers.dev/guides/css-overrides#typescript, the error is gone: https://codesandbox.io/s/youthful-architecture-f8m19?file=/src/timerange.test.tsx. The bug was fixed 👌.

@oliviertassinari oliviertassinari added bug 🐛 Something isn't working and removed status: incomplete Need more information labels Jun 4, 2020
@oliviertassinari
Copy link
Member

@MuratGT See #1858 for a follow-up iteration on the problem, in order to polish it. But the bulk of the problem should already be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working typescript
Projects
None yet
Development

No branches or pull requests

3 participants