-
Notifications
You must be signed in to change notification settings - Fork 247
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
Add typings for MaterialUI overrides #260
Comments
This is great! Thank you so much! For future Typescripts users who will follow, create a new file called See this link for more information (module augmentation). |
This doesn't work for me. I get another TypeScript error: |
Which version of TypeScript are you using? I'm using TypeScript and it works like a charm. These are my package versions in case you want to know: "@material-ui/core": "^4.12.3"
"@material-ui/icons": "^4.11.2"
"@types/node": "^12.0.0"
"@types/react": "^17.0.0"
"@types/react-dom": "^17.0.0"
"material-ui-dropzone": "^3.5.0"
"react": "^17.0.2"
"typescript": "^4.1.2" I've created my app using |
These are the exact versions I'm on currently: "@material-ui/core": "4.12.3"
"@material-ui/icons": "4.11.2"
"@types/node": "16.11.0"
"@types/react": "17.0.30"
"@types/react-dom": "17.0.9"
"material-ui-dropzone": "3.5.0"
"react": "17.0.2"
"typescript": "4.4.4" I get a different warning this time by the way: |
I think you can, since it is an error from eslint error and not from TypeScript. Maybe, your eslint rules have not allowed the use of empty interfaces. |
@AnthonyLzq ow, haha, I didn't see that. I'll see if I can fix that rule or ignore it then. Thanks for pointing that out. |
Feature Request
Describe the problem related to this feature request
When I'm overriding the Material UI theme, the keys from the MUIDropzone are not available for use.
Describe the solution you'd like
The ability to easily extend the MUI theme overrides type with the overridable props for MUIDropzone.
Describe alternatives you've considered
TS-Ignore, but that isn't going to work well if a new version changes something, and breaks the type safety of typescript.
Implementing the change manually by redefining the possible types and redeclaring the Material UI overrides type with them included.
Teachability, Documentation, Adoption, Migration Strategy
A component library named material-ui-pickers does this, and it is easy to extend the overrides for typescript compatibility.
This change would only affect Typescript users who wish to override MUI styles, and would be backwards compatible since nothing existed in the past for this functionality which could be broken by this.
Additional context
The following is working for type inspections etc within my Typescript project built within the JetBrains Webstorm IDE:
Of course, there may be a better way of achieving the outcome. This is just what I've done to make it work.
The text was updated successfully, but these errors were encountered: